def all_pairs_dijkstra_path(G, cutoff=None, weight='weight'):
 path = single_source_dijkstra_path
 return {n: path(G, n, cutoff=cutoff, weight=weight) for n in G}

def all_pairs_dijkstra_path ( G , cutoff = None , weight = 'weight' ) : path = single_source_dijkstra_path return { n : path ( G , n , cutoff = cutoff , weight = weight ) for n in G }
compute shortest paths between all nodes in a weighted graph .