Graph::VF2(3pm)

NAME
Graph::MoreUtils - VF2 subgraph isomorphism detection method for Perl Graph

SYNOPSIS
    use Graph::Undirected;
    use Graph::VF2 qw( matches );

    my $small = Graph::Undirected->new;
    my $large = Graph::Undirected->new;

    # Create graphs here

    # Find all subgraphs of $small in $large:
    my @matches = matches( $small, $large );

METHODS

  "matches( $g1, $g2, $options )"
Takes two Graph::Undirected objects, $g1 and $g2 and returns an array of occurrences of $g1 in $g2. Returned array consists of array references, each array reference describing one occurrence. In it, encoded as array references, is the list of pairwise vertex correspondences. First item in a pair is a vertex from $g1, and second item being a vertex in $g2. No attempt is made to collate isomorphic matches. Thus a search of N-element cycle graph in itself will produce 2 * N matches due to graph's symmetry.

$options is a hash reference of options with the following keys:

"vertex_correspondence_sub"
    A subroutine reference used to evaluate the equality of vertices, called with $v1 and $v2 from $g1 and $g2, accordingly. Should return Perl true and false equivalents to signify match and non-match, accordingly. Unless provided, all vertices are treated as equal.

"edge_correspondence_sub"
    A subroutine reference used to evaluate the equality of edges, called with $v1 and $v2 from $g1, and $v3 and $v4 from $g2, accordingly. Edges are represented as pairs of vertices and are passed as a flat array. Should return Perl true and false equivalents to signify match and non-match, accordingly. Unless provided, all edges are treated as equal.

AUTHORS
Andrius Merkys, <merkys@cpan.org>