def all_pairs_shortest_path_length(G, cutoff=None):
 length = single_source_shortest_path_length
 for n in G:
  (yield (n, dict(length(G, n, cutoff=cutoff))))

def all_pairs_shortest_path_length ( G , cutoff = None ) : length = single_source_shortest_path_length for n in G : ( yield ( n , dict ( length ( G , n , cutoff = cutoff ) ) ) )
computes the shortest path lengths between all nodes in g .