Skip to main content

forgotten_coindex

Function forgotten_coindex 

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

Compute the forgotten coindex (F-coindex).

\bar{F}(G) = Σ_{u<v, (u,v)∉E} [d(u)²+d(v)²]

Uses the identity: \bar{F} = (n-1)·Σd² - F(G) where F(G) is the forgotten index.

§Examples

use rust_igraph::{Graph, forgotten_coindex};

// K_3: no non-adjacent pairs → 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(forgotten_coindex(&g).unwrap(), 0);

// Path 0-1-2: non-adj (0,2), d=(1,1) → 1+1 = 2
let p = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert_eq!(forgotten_coindex(&p).unwrap(), 2);