The AllPairsShortestPath function computes the shortest distances between all combinations of the specified source and target vertices. The function works on directed, undirected, weighted, and unweighted graphs.
The function is useful in social network analysis. The resulting pairs and distances can be aggregated to determine a closeness metric or the k-degree for each vertex in a graph.