Skip to main content

motifs_randesu_no

Function motifs_randesu_no 

Source
pub fn motifs_randesu_no(graph: &Graph, size: u32) -> IgraphResult<f64>
Expand description

Count the total number of connected induced subgraphs of a given size.

Unlike motifs_randesu, this does not classify by isomorphism class and supports arbitrary motif sizes (≥ 3).

§Arguments

  • graph — the input graph.
  • size — motif size (must be ≥ 3).

§Examples

use rust_igraph::{Graph, motifs_randesu_no};

// Complete graph K4 has 4 triangles
let mut g = Graph::with_vertices(4);
for u in 0..4u32 {
    for v in (u + 1)..4 {
        g.add_edge(u, v).unwrap();
    }
}
assert!((motifs_randesu_no(&g, 3).unwrap() - 4.0).abs() < 1e-10);