Skip to main content

degree_profile

Function degree_profile 

Source
pub fn degree_profile(graph: &Graph) -> IgraphResult<Vec<f64>>
Expand description

Compute degree profile for each vertex: [deg, deg², log(deg+1)].

A lightweight alternative to the full feature vector when only degree-based features are needed.

Returns a flat Vec<f64> of length 3 * vcount, row-major.

§Examples

use rust_igraph::{Graph, degree_profile};

let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let prof = degree_profile(&g).unwrap();
// Vertex 0: deg=2, deg²=4, log(3)
assert!((prof[0] - 2.0).abs() < 1e-10);
assert!((prof[1] - 4.0).abs() < 1e-10);