Networkx - How to get shortest path length between nodes showing node id instead of label
问题 I'm new to using NetworkX library with Python. Let's say that I import a Pajek-formatted file: import networkx as nx G=nx.read_pajek("pajek_network_file.net") G=nx.Graph(G) The contents of my file are (In Pajek, nodes are called "Vertices"): *Network *Vertices 6 123 Author1 456 Author2 789 Author3 111 Author4 222 Author5 333 Author6 *Edges 123 333 333 789 789 222 222 111 111 456 Now, I want to calculate all the shortest path lengths between the nodes in my network, and I'm using this function