Skip to main content

get_subisomorphisms_vf2

Function get_subisomorphisms_vf2 

Source
pub fn get_subisomorphisms_vf2(
    graph1: &Graph,
    graph2: &Graph,
    vertex_color1: Option<&[u32]>,
    vertex_color2: Option<&[u32]>,
    edge_color1: Option<&[u32]>,
    edge_color2: Option<&[u32]>,
) -> IgraphResult<Vec<Vec<u32>>>
Expand description

Collect every VF2 subgraph-isomorphic embedding of the pattern graph2 into the target graph1.

Each returned vector is a map21 embedding: position j holds the target vertex that pattern vertex j maps to. The list is empty when the pattern does not embed. Colour arguments behave as in subisomorphic_vf2.

§Errors

Same conditions as subisomorphic_vf2.

§Examples

use rust_igraph::{Graph, get_subisomorphisms_vf2};

// A path P3 embeds into a 4-cycle in 8 ways.
let mut c4 = Graph::new(4, false).unwrap();
c4.add_edge(0, 1).unwrap();
c4.add_edge(1, 2).unwrap();
c4.add_edge(2, 3).unwrap();
c4.add_edge(3, 0).unwrap();
let mut p3 = Graph::new(3, false).unwrap();
p3.add_edge(0, 1).unwrap();
p3.add_edge(1, 2).unwrap();
let maps = get_subisomorphisms_vf2(&c4, &p3, None, None, None, None).unwrap();
assert_eq!(maps.len(), 8);