Skip to main content

count_subisomorphisms_vf2

Function count_subisomorphisms_vf2 

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

Count the number of VF2 subgraph-isomorphic embeddings of the pattern graph2 into the target graph1.

Colour arguments behave as in subisomorphic_vf2.

§Errors

Same conditions as subisomorphic_vf2.

§Examples

use rust_igraph::{Graph, count_subisomorphisms_vf2};

// A single edge embeds into a triangle in 6 ways (3 edges x 2 directions).
let mut tri = Graph::new(3, false).unwrap();
tri.add_edge(0, 1).unwrap();
tri.add_edge(1, 2).unwrap();
tri.add_edge(2, 0).unwrap();
let mut edge = Graph::new(2, false).unwrap();
edge.add_edge(0, 1).unwrap();
let count = count_subisomorphisms_vf2(&tri, &edge, None, None, None, None).unwrap();
assert_eq!(count, 6);