title: Networkx - How to get shortest path length between nodes showing node id instead of label
body: <p>I'm new to using NetworkX library with Python.</p>
  
  <p>Let's say that I import a Pajek-formatted file:</p>
  
  <pre><code>import networkx as nx
  G=nx.read_pajek("pajek_network_file.net")
  G=nx.Graph(G)
  </code></pre>
  
  <p>The contents of my file are (In Pajek, nodes are called "Vertices"):</p>
  
  <pre><code>*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
  </code></pre>
  
  <p>Now, I want to calculate all the shortest path lengths between the nodes in my network, and I'm using this function, per the library documentation</p>
  
  <pre><code>path = nx.all_pairs_shortest_path_length(G)
  </code></pre>
  
  <p>Returns:    lengths – Dictionary of shortest path lengths keyed by source and target.</p>
  
  <p>The return I'm getting:</p>
  
  <pre><code>print path
  {u'Author4': {u'Author4': 0, u'Author5': 1, u'Author6': 3, u'Author1': 4, u'Author2': 1, u'Author3': 2}, u'Author5': {u'Author4': 1, u'Author5': 0, u'Author6': 2, u'Author1': 3, u'Author2': 2, u'Author3': 1}, u'Author6': {u'Author4': 3, u'Author5': 2, u'Author6': 0, u'Author1': 1, u'Author2': 4, u'Author3': 1}, u'Author1': {u'Author4': 4, u'Author5': 3, u'Author6': 1, u'Author1': 0, u'Author2': 5, u'Author3': 2}, u'Author2': {u'Author4': 1, u'Author5': 2, u'Author6': 4, u'Author1': 5, u'Author2': 0, u'Author3': 3}, u'Author3': {u'Author4': 2, u'Author5': 1, u'Author6': 1, u'Author1': 2, u'Author2': 3, u'Author3': 0}}
  </code></pre>
  
  <p>As you can see, it's really hard to read, and to put to a later use...</p>
  
  <p>Ideally, what I'd like is a return with a format similar to the below:</p>
  
  <pre><code>source_node_id, target_node_id, path_length
  123, 456, 5
  123, 789, 2
  123, 111, 4
  </code></pre>
  
  <p>In short, I need to get a return using only (or at least including) the nodes ids, instead of just showing the node labels. And, to get every possible pair in a single line with their corresponding shortest path...</p>
  
  <p>Is this possible in NetworkX?</p>
  
  <p>Function Reference: <a href="https://networkx.github.io/documentation/latest/reference/generated/networkx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path_length.html" rel="nofollow">https://networkx.github.io/documentation/latest/reference/generated/networkx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path_length.html</a></p>