def all_pairs_bellman_ford_path_length(G, cutoff=None, weight='weight'):
 length = single_source_bellman_ford_path_length
 for n in G:
  (yield (n, dict(length(G, n, cutoff=cutoff, weight=weight))))

def all_pairs_bellman_ford_path_length ( G , cutoff = None , weight = 'weight' ) : length = single_source_bellman_ford_path_length for n in G : ( yield ( n , dict ( length ( G , n , cutoff = cutoff , weight = weight ) ) ) )
compute shortest path lengths between all nodes in a weighted graph .