findCycles method
Implementation
HashSet<T> findCycles(T n) {
_perm.clear();
_temp.clear();
_cycleNodes.clear();
_order.clear();
var cycles = stronglyConnectedComponents<T>([n], dependentsOf);
cycles.forEach((cycle) {
// cycles of len 1 are not cycles.
if (cycle.length > 1) {
cycle.forEach(_cycleNodes.add);
}
});
return _cycleNodes;
}