Skip to main content

eccentricity_with_mode

Function eccentricity_with_mode 

Source
pub fn eccentricity_with_mode(
    graph: &Graph,
    mode: EccMode,
) -> IgraphResult<Vec<u32>>
Expand description

Eccentricity of every vertex following mode-direction edges.

Counterpart of igraph_eccentricity(_, NULL_weights, _, igraph_vss_all(), mode). For undirected graphs every mode reduces to EccMode::All (every edge is bidirectional).

§Examples

use rust_igraph::{Graph, eccentricity_with_mode, EccMode};

// Directed path 0→1→2: out-mode says ecc[2]=0; in-mode says ecc[0]=0;
// all-mode treats it like an undirected path.
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert_eq!(eccentricity_with_mode(&g, EccMode::Out).unwrap(), vec![2, 1, 0]);
assert_eq!(eccentricity_with_mode(&g, EccMode::In).unwrap(),  vec![0, 1, 2]);
assert_eq!(eccentricity_with_mode(&g, EccMode::All).unwrap(), vec![2, 1, 2]);