I'm running a Dikjstra's shortest path algorithm on a NetworkX Watts-Strogatz randomly generated graph and I want to color the edges of the path I've found differently from the rest of the edges before I draw the graph.
My Dijkstra's algorithm returns a list of the nodes in the path as follows:
dijkstra(graph, '5', '67')
['67', '62', '59', '56', '3', '99', '5']
How would I go about changing the color of the edges between these nodes to say blue instead of red?
Note that the graph is randomly generated so the path changes every time, but it will always output the nodes in the path as a list.
I initially tried something along the lines of:
for i in range(path.__len__()):
if i != path.__len__()-1:
wsGraph.add_edge(path[i], path[i]+1, color='b')
But that didn't modify the edges and instead just added what looked like new nodes.