|
for x in edges: |
|
d[x[0]] = {} |
|
d[x[1]] = {} |
|
for x in edges: |
|
d[x[0]][x[1]] = x[2] |
|
d[x[1]][x[0]] = x[2] |
If there is a node that has more than one edge coming out if it, will the second edge override the first edge? Could you do something like...
d[x[0]] = d[x[0]] if x[0] in d else {}
Shortest_Path_Graph_Dijkstra/main.py
Lines 65 to 70 in f916007
If there is a node that has more than one edge coming out if it, will the second edge override the first edge? Could you do something like...