No description, website, or topics provided.
Other
Switch branches/tags
Nothing to show
Latest commit 10f526b May 25, 2017 @finanalyst committed on GitHub make network creation eager
Permalink
Failed to load latest commit information.
lib/Algorithm
logotype change logo name Jun 4, 2016
t
.gitignore Used with rather than if ... .defined & kludge for some datasets May 23, 2017
.travis.yml using example from travis web site May 25, 2017
LICENSE Initial commit May 26, 2016
META6.json
README.md Update README.md Jun 4, 2016

README.md

p6-Algorithm-Tarjan

A perl6 implementation of Tarjan's algorithm for finding strongly connected components in a directed graph.

More information can be found at wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm.

If there is a cycle, then it will be within a strongly connected component. This implies that the absence of strongly connected components (other than a node with itself) means there are no cycles. It is possible there may be no cycles, but a strongly connected component may still exist (if I have interpreted the theory correctly). I was interested in the absence of cycles.

use Algorithm::Tarjan;

my Algorithm::Tarjan $a .= new();

my %h;
# code to fill %h node->[successor nodes]

$a.init(%h);
say 'There are ' ~ $a.find-cycles() ~ ' cycle(s) in the input graph';

If there is a need for the sets of strongly connected components, they can be retrieved from $a.strongly-connected (an array of node names).