The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Graph::SomeUtils - Some utility functions for Graph objects

SYNOPSIS

  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);
  

DESCRIPTION

Some helper functions for working with Graph objects.

FUNCTIONS

graph_delete_vertex_fast($g, $v)

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.

graph_delete_vertices_fast($g, $v1, $v2, ...)

Same as graph_delete_vertex_fast for multiple vertices.

graph_vertices_between($g, $source, $destination)

Returns the intersection of vertices that are reachable from $source and vertices from which $destination is reachable, including the $source and $destination vertices themself.

graph_all_successors_and_self($g, $v)

Returns the union of $g-all_successors($v)> and $v in an arbitrary order.

graph_all_predecessors_and_self($g, $v)

Returns the union of $g-all_predecessors($v)> and $v in an arbitrary order.

EXPORTS

None by default, each of the functions by request. Use :all to import them all at once.

AUTHOR / COPYRIGHT / LICENSE

  Copyright (c) 2014 Bjoern Hoehrmann <bjoern@hoehrmann.de>.
  This module is licensed under the same terms as Perl itself.