Skip to main content

edge_betweenness_weighted

Function edge_betweenness_weighted 

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

Per-edge weighted betweenness centrality (Vec<f64>).

result[e] is the raw count of shortest paths between all (s, t) pairs that use edge e. Undirected results are halved.

weights[e] must be non-negative and finite; weights.len() must equal graph.ecount().

§Examples

use rust_igraph::{Graph, edge_betweenness_weighted};

// 4-path with unit weights → matches PR-010 unweighted result.
let mut g = Graph::with_vertices(4);
for i in 0..3u32 { g.add_edge(i, i + 1).unwrap(); }
let eb = edge_betweenness_weighted(&g, &[1.0, 1.0, 1.0]).unwrap();
assert_eq!(eb, vec![3.0, 4.0, 3.0]);