Skip to main content

eccentricity_weighted_with_mode

Function eccentricity_weighted_with_mode 

Source
pub fn eccentricity_weighted_with_mode(
    graph: &Graph,
    weights: &[f64],
    mode: EccMode,
) -> IgraphResult<Vec<f64>>
Expand description

Mode-aware weighted eccentricity. For each vertex v, returns max_{u reachable from v} dist(v, u), where distances are weighted shortest-path lengths (Dijkstra). Unreachable vertex pairs are ignored (matches upstream’s unconn=true); isolated vertices have eccentricity 0.0.

Counterpart of igraph_eccentricity(_, weights, _, igraph_vss_all(), mode).

Edge weights must be non-negative and not NaN.

§Examples

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

// Path 0-1-2 with weights (1.0, 2.5): vertex 0 has ecc 3.5,
// vertex 1 has ecc 2.5, vertex 2 has ecc 3.5.
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let r = eccentricity_weighted_with_mode(&g, &[1.0, 2.5], EccMode::All).unwrap();
assert_eq!(r, vec![3.5, 2.5, 3.5]);