Data::Graph::Util - Utilities related to graph data structure
This document describes version 0.001 of Data::Graph::Util (from Perl distribution Data-Graph-Util), released on 2016-06-24.
use Data::Graph::Util qw(toposort is_cyclic is_acyclic); my @sorted = toposort( { a=>["b"], b=>["c", "d"], c=>[], d=>["c"] }, # graph ); # => ("a", "b", "d", "c") say is_cyclic ({a=>["b"]}); # => 0 say is_acyclic({a=>["b"]}); # => 1 say is_cyclic ({a=>["b"], b=>["c"], c=>["a"]}); # => 1 say is_acyclic({a=>["b"], b=>["c"], c=>["a"]}); # => 0
Early release. More functions will be added later.
None are exported by default, but they are exportable.
Return true if graph contains at least one cycle.
Return true if graph is acyclic, i.e. contains no cycles.
Please visit the project's homepage at https://metacpan.org/release/Data-Graph-Util.
Source repository is at https://github.com/perlancar/perl-Data-Graph-Util.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Graph-Util
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
https://en.wikipedia.org/wiki/Graph_(abstract_data_type)
Sort::Topological can also sort a DAG, but cannot handle cyclical graph.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2016 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Graph::Util, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Graph::Util
CPAN shell
perl -MCPAN -e shell install Data::Graph::Util
For more information on module installation, please visit the detailed CPAN module installation guide.