I have this code to plot a visualization to a Djikstra Problem. I am having a bad time trying to print de node's label, like: A, B C, D... The graph and distances(weigths) are ok! I just need the node's label.
Can anyone help me?
import networkx as nx G = nx.read_edgelist("edges.txt", delimiter=",", data=[("weight", int)]) G.edges(data=True) edge_labels = dict( ((u, v), d["weight"]) for u, v, d in G.edges(data=True) ) pos = nx.random_layout(G) nx.draw(G, pos) nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels) import matplotlib.pyplot as plt; plt.show()