Modified Tarjan SCC to reduce memory usage. (#413)
Modified Tarjan SCC to reduce memory usage. (#413)

* Modified Tarjan SCC to reduce memory usage.

Reduced heap memory usage to a single vec allocation, improved cache locality,
and made the code cleaner for a possible future rewrite to a more
optimized imperative version.

In addition, the new version has the property that it builds a lookup
table for the components. If v belongs to the kth output component, then
self.nodes[g.to_index(v)] == Some(k) . This can be used to save work in
functions that may want to call it such as condensation.

* added std:: in front of std::usize::MAX

* Rustfmt-ed the code.

* Added node_component_index, adopted NonZeroUsize, reversed counters.

* Minor change to node_component_index.

* Docs update. Added citation to paper with link.

* Improve tarjan scc performance

Tests the visited flag before doing the recursive call.

Co-authored-by: Agustin Borgna <92b183fa39162c545c001c26824793e014b254dd@gmail.com>
petgraph/petgraph