Graph::SomeUtils - Some utility functions for Graph objects
use Graph::SomeUtils ':all'; graph_delete_vertex_fast($g, 'a'); graph_delete_vertices_fast($g, 'a', 'b', 'c'); my @pred = graph_all_predecessors_and_self($g, $v); my @succ = graph_all_successors_and_self($g, $v); my @between = graph_vertices_between($g, $source, $dest);
Some helper functions for working with Graph objects.
The delete_vertex method of the Graph module v0.96 is very slow. This function is an order-of-magnitude faster alternative. It accesses internals of the Graph module and might break under newer versions of the module.
delete_vertex
v0.96
Same as graph_delete_vertex_fast for multiple vertices.
graph_delete_vertex_fast
Returns the intersection of vertices that are reachable from $source and vertices from which $destination is reachable, including the $source and $destination vertices themself.
$source
$destination
Returns the union of $g-all_successors($v)> and $v in an arbitrary order.
$g-
$v
Returns the union of $g-all_predecessors($v)> and $v in an arbitrary order.
Shorthand for getting the vertex attribute label.
label
Shorthand for setting the vertex attribute label.
Removes edges coming in and going out of $v.
Deletes vertices except @vertices.
@vertices
Removes all vertices that are neither $start or $final nor on a path between them.
$start
$final
None by default, each of the functions by request. Use :all to import them all at once.
:all
Copyright (c) 2014 Bjoern Hoehrmann <bjoern@hoehrmann.de>. This module is licensed under the same terms as Perl itself.
To install Graph::SomeUtils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::SomeUtils
CPAN shell
perl -MCPAN -e shell install Graph::SomeUtils
For more information on module installation, please visit the detailed CPAN module installation guide.