Error in exercise 1 of week3

Hi,

when i am trying to test my code i am getting the below error when running the unit test (unittests.test_shortest_path(GraphShortestPath))

this is the error i get:

Process shortest_path:
Traceback (most recent call last):
File “/opt/conda/lib/python3.11/multiprocessing/process.py”, line 314, in _bootstrap
self.run()
File “/opt/conda/lib/python3.11/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/home/jovyan/work/unittests.py”, line 51, in helper
out = func(*arg)
^^^^^^^^^^
File “/tmp/ipykernel_11936/512831735.py”, line 46, in shortest_path
for neighbor, weight in graph.graph[current_vertex].items():
~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 654

Is the graph a list of a dictionary? It doesn’t make any sense, try to feed your code solution to the LLM and also feed it this error and observe its feedback.

I think the way you are using the graph instance be it a dictionary or a list maybe not right!