Hi, I'm trying to implement Dijkstra Algorithm and am using the networkx library.
With the following code, the weights are displayed correctly in the first block of print statements in initializesinglesource
0 0 35
0 1 12
0 3 13
0 4 21
1 0 27
1 1 33
1 2 8
1 3 29
However when we return from the call, the weight values are showng up as 0 and other increect values in dijkstra print block
0 0 35
0 1 0
0 3 0
0 4 0
1 0 39
1 1 33
1 2 0
1 3 28
def initializesinglesource(g, s):
nx.set_node_attributes(g, float("inf"), 'd')