pub fn isomorphic_vf2(
graph1: &Graph,
graph2: &Graph,
vertex_color1: Option<&[u32]>,
vertex_color2: Option<&[u32]>,
edge_color1: Option<&[u32]>,
edge_color2: Option<&[u32]>,
) -> IgraphResult<Vf2Isomorphism>Expand description
Test whether two graphs are isomorphic using the VF2 algorithm.
Optional vertex_color* / edge_color* slices restrict the matching:
two vertices (edges) may correspond only if their colours are equal. Pass
None for uncoloured graphs; supplying a colour for only one side makes
that colour be ignored (matching upstream).
On success Vf2Isomorphism::iso tells whether a mapping exists; when it
does, map12 / map21 hold the permutation and its inverse, otherwise
they are empty.
§Errors
Returns IgraphError::InvalidArgument if the two graphs differ in
directedness, if either contains a self-loop (VF2 does not support loops),
or if a supplied colour vector has the wrong length.
§Examples
use rust_igraph::{Graph, isomorphic_vf2};
// Two triangles with relabelled vertices are isomorphic.
let mut a = Graph::new(3, false).unwrap();
a.add_edge(0, 1).unwrap();
a.add_edge(1, 2).unwrap();
a.add_edge(2, 0).unwrap();
let mut b = Graph::new(3, false).unwrap();
b.add_edge(0, 2).unwrap();
b.add_edge(2, 1).unwrap();
b.add_edge(1, 0).unwrap();
let r = isomorphic_vf2(&a, &b, None, None, None, None).unwrap();
assert!(r.iso);
assert_eq!(r.map12.len(), 3);