Skip to main content

motifs_randesu

Function motifs_randesu 

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

Motif census: count motifs of each isomorphism class.

Returns a histogram where hist[c] is the number of connected induced subgraphs of the given size whose isomorphism class is c. Disconnected isomorphism classes are reported as f64::NAN.

§Arguments

  • graph — the input graph.
  • size — motif size (3 or 4 for directed; 3, 4, or 5 for undirected).

§Examples

use rust_igraph::{Graph, motifs_randesu};

// Triangle: one 3-vertex motif of class 3 (complete undirected)
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(0, 2).unwrap();
let hist = motifs_randesu(&g, 3).unwrap();
assert!((hist[3] - 1.0).abs() < 1e-10);