Skip to main content

diameter_weighted_with_mode

Function diameter_weighted_with_mode 

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

Mode-aware weighted diameter. None for vcount == 0.

Counterpart of igraph_diameter(_, weights, _, NULL, NULL, NULL, NULL, mode == directed ? IGRAPH_OUT : IGRAPH_ALL, /*unconn=*/true).

ยงExamples

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

let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let d = diameter_weighted_with_mode(&g, &[1.0, 2.0], EccMode::All).unwrap();
assert!((d.unwrap() - 3.0).abs() < 1e-9);