Skip to main content

eccentricity

Function eccentricity 

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

Eccentricity of every vertex (length vcount). Result r[v] is the maximum shortest-path distance from v to any reachable vertex. Isolated vertices have eccentricity 0.

Counterpart of igraph_eccentricity(_, NULL_weights, _, igraph_vss_all(), IGRAPH_OUT).

ยงExamples

use rust_igraph::{Graph, eccentricity};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
assert_eq!(eccentricity(&g).unwrap(), vec![3, 2, 2, 3]);