Graph::VF2(3pm)
πΈ NAME πΈ
okay so bestie, the NAME section literally says Graph::MoreUtils β VF2 subgraph isomorphism detection method for Perl Graph. yes, that's the name it's filed under, no cap π«Ά
β¨ SYNOPSIS β¨
the little taste test, literally how you'd use it:
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 );
that's it, that's the whole vibe π
π¦ METHODS π¦
π matches( $g1, $g2, $options ) π
so this one takes two Graph::Undirected objects β $g1 and $g2 β and hands you back an array of occurrences of $g1 inside $g2. icon behavior, honestly.
and what's in that returned array? array references, babes. each array ref describes one occurrence. inside it, also encoded as array references, you get the list of pairwise vertex correspondences. and the order matters:
- first item in a pair = a vertex from
$g1π - second item in a pair = a vertex in
$g2π
β οΈ and this part is important: no attempt is made to collate isomorphic matches. so if you search an N-element cycle graph in itself, you're gonna get 2 * N matches, because that's just the graph's symmetry doing its thing. it's not a bug, it's a feature-type situation, fr fr.
$options is a hash reference of options, and it's got these keys:
vertex_correspondence_subβ a subroutine reference used to evaluate the equality of vertices. it gets called with$v1and$v2from$g1and$g2, accordingly. it should return Perl true and false equivalents to signify match and non-match, accordingly. unless you provide it, all vertices are treated as equal. πedge_correspondence_subβ a subroutine reference used to evaluate the equality of edges. it gets called with$v1and$v2from$g1, and$v3and$v4from$g2, accordingly. edges are represented as pairs of vertices and are passed as a flat array, iykyk. it should return Perl true and false equivalents to signify match and non-match, accordingly. and unless you provide it, all edges are treated as equal. slay β¨
π AUTHORS π
Andrius Merkys, <merkys@cpan.org> β the main character who made all this happen π«Ά
and that's a wrap, bestie!! this gorgeous thing was documented for perl v5.42.3, dated 2026-08-19 β yeah, go off, timestamps πβ¨πΈ
π¦ where this page comes from
- ubuntu stonking: libgraph-vf2-perl 0.2.0-1build1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms