Skip to main content

graphlets_project

Function graphlets_project 

Source
pub fn graphlets_project(
    graph: &Graph,
    weights: &[f64],
    cliques: &[Vec<VertexId>],
    start_mu: Option<&[f64]>,
    niter: u32,
) -> IgraphResult<Vec<f64>>
Expand description

Project a graph onto a graphlets basis.

Performs niter iterations of the multiplicative update (NNLS-like). If start_mu is Some(vec), uses it as the initial weight vector; otherwise starts from all-ones.

§Errors

  • InvalidArgument if weights length doesn’t match edge count, start_mu length doesn’t match clique count, niter < 0, or the graph is not simple.

§Examples

use rust_igraph::{Graph, graphlets_candidate_basis, graphlets_project};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(2, 3).unwrap();

let weights = [1.0, 2.0, 1.0, 3.0];
let basis = graphlets_candidate_basis(&g, &weights).unwrap();
let mu = graphlets_project(&g, &weights, &basis.cliques, None, 1000).unwrap();
assert_eq!(mu.len(), basis.cliques.len());