Skip to main content

wiener_polarity_index

Function wiener_polarity_index 

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

Compute the Wiener polarity index of a graph.

Counts unordered vertex pairs {u, v} with shortest-path distance exactly 3. For directed graphs, counts ordered pairs (u, v) with d(u,v) = 3.

ยงExamples

use rust_igraph::{Graph, wiener_polarity_index};

// Path 0-1-2-3: only pair {0,3} is at distance 3
let g = Graph::from_edges(&[(0,1),(1,2),(2,3)], false, Some(4)).unwrap();
assert_eq!(wiener_polarity_index(&g).unwrap(), 1);