Graph::Subgraph - A subgraph() method for Graph module.
[DEPRECATED] "subgraph" in Graph was added in Graph 0.97, so this module is now useless and does nothing, unless outdated Graph is detected.
Graph
use Graph; use Graph::Subgraph; my $foo = Graph->new(); $foo->add_edges(qw(x y y z)); my $bar = $foo->subgraph(['x', 'y']); # $bar is now 'x-y'
The only method resides in the Graph package (not Graph::Subgraph) so that any descendant of Graph can call it.
Returns a subgraph of the original graph induced by two sets of vertices.
A vertex is copied if and only if it belongs to one of the sets. An edge is copied if and only if it starts in the first set and ends in the second set.
If only one set is given, it is used as both. (So that is "subgraph induced by a set of vertices").
The sets may be given as one or two array references, or list.
The properties of the original graph (directedness etc.) are preserved, however the properties of vertices and edges are not.
Complexity: This method has a computational complexity of O(N(src)*N(dst)).
In theory, O(N(egdes_in_initial_graph)) is also possible, and the algorithm should choose whichever is better. This is not done yet.
Feel free to file a bug report if there's anything faster.
Konstantin S. Uvarin, <khedin at gmail.com>
<khedin at gmail.com>
This module should be merged into Graph.
Please report any bugs or feature requests to bug-graph-subgraph at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Subgraph. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-graph-subgraph at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Graph::Subgraph
You can also look for information at:
github
https://github.com/dallaylaen/perl-Graph-Subgraph
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Graph-Subgraph
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Graph-Subgraph
CPAN Ratings
http://cpanratings.perl.org/d/Graph-Subgraph
Search CPAN
http://search.cpan.org/dist/Graph-Subgraph/
Copyright 2012 Konstantin S. Uvarin.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Graph::Subgraph, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Subgraph
CPAN shell
perl -MCPAN -e shell install Graph::Subgraph
For more information on module installation, please visit the detailed CPAN module installation guide.