Template Function ADS::distance(const G&, int)

Function Documentation

template<Graph G>
std::pair<std::vector<int>, std::vector<int>> ADS::distance(const G &g, int r)

distance(): the distances from r, INF if not reachable, and the parents in the tree of the shortest paths, NIL for r and the unreachable nodes

Pre:

r is a node

Post:

each edge ( u , v ) from a reached u has d[ v ] <= d[ u ] + 1, and each reached v but r has d[ v ] = d[ p[ v ] ] + 1 (audit)