pub fn transitive_closure(graph: &Graph) -> GraphExpand description
Returns the transitive closure of graph: the same nodes, with an edge u -> v wherever a path
of one or more edges leads from u to v.
A node has a self-loop in the result if and only if it lies on a cycle. The result can have up to
node_count² edges; for the nodes reachable from a few nodes, reachable_from_sources costs far
less.
The closure is computed on the SCCs (strongly connected components) of graph, with a row of bits
per SCC for the SCCs it reaches. The rows take scc_count² / 8 bytes, about 1.25 GB for 100 000
SCCs.
Time: O(node_count + edge_count + scc_count x (scc_count + edge_count) / 64 + result_edge_count log node_count), with scc_count the number of SCCs. Memory: 4 bytes per node and per edge for the result; while it runs, scc_count² / 8 bytes for the rows, which are held together with the result at the peak, and O(node_count + edge_count) more.
§Panics
With an invalid argument message if the closure has more edges than a graph can have, or graph
has more than 2^30 - 5 nodes.