Skip to main content

structural_feature_vectors

Function structural_feature_vectors 

Source
pub fn structural_feature_vectors(
    graph: &Graph,
) -> IgraphResult<StructuralFeatures>
Expand description

Compute structural feature vectors for all vertices.

Each vertex gets a feature vector containing: 0. degree — vertex degree

  1. log_degree — log2(1 + degree)
  2. clustering — local clustering coefficient
  3. avg_neighbor_degree — mean degree of neighbors
  4. min_neighbor_degree — minimum degree among neighbors
  5. max_neighbor_degree — maximum degree among neighbors
  6. triangles — number of triangles containing this vertex
  7. square_clustering — fraction of possible squares closed

§Examples

use rust_igraph::{Graph, structural_feature_vectors};

let g = Graph::from_edges(&[(0,1),(1,2),(0,2),(2,3)], false, Some(4)).unwrap();
let sf = structural_feature_vectors(&g).unwrap();
assert_eq!(sf.num_vertices, 4);
assert_eq!(sf.num_features, 8);
// Vertex 0 has degree 2
assert!((sf.vertex_features(0)[0] - 2.0).abs() < 1e-10);