Learn Algorithm Design by Building a Shortest Path Algorithm - Step 14

Add one last node, D , which is connected with A and C. Modify your dictionary to represent this structure. Again, use a list to represent multiple connections. Guess what, I did, and the code isn’t working!
Here is my code:


# User Editable Region

my_graph = {
    'A': 'B',
    'B': ['A', 'C'],
    'C': 'B',
    'D': ['A', 'C']
}

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0

Challenge Information:

Learn Algorithm Design by Building a Shortest Path Algorithm - Step 14

Hello!

The challenge wants the node connections to be bidirectional. You have to update nodes A and C as well in the dictionary.

1 Like

Thanks Daniel,
It was strange. I originally had the correct answer. Then I changed it, thinking I went to far or read too far into the question. I later cut & pasted my ordinal answer and then it passed.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.