Skip to main content

gordon_scantlebury_index

Function gordon_scantlebury_index 

Source
pub fn gordon_scantlebury_index(graph: &Graph) -> IgraphResult<u64>
Expand description

Compute the Gordon-Scantlebury index (path-of-length-2 count).

GS(G) = Platt(G) / 2 = Σ_{(u,v)∈E} (d(u) + d(v) - 2) / 2

Counts the number of paths of length 2 (P₂) in the graph. Equivalently, GS = Σ_v C(d(v), 2) = Σ_v d(v)·(d(v)-1)/2.

Self-loops are skipped.

§Examples

use rust_igraph::{Graph, gordon_scantlebury_index};

// K_3: Platt=6, GS=3 (three paths of length 2)
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(gordon_scantlebury_index(&g).unwrap(), 3);