def all_pairs_shortest_path(G, cutoff=None):
 return {n: single_source_shortest_path(G, n, cutoff=cutoff) for n in G}

def all_pairs_shortest_path ( G , cutoff = None ) : return { n : single_source_shortest_path ( G , n , cutoff = cutoff ) for n in G }
compute shortest paths between all nodes .