pub fn eccentricity<G>(graph: G, node: G::NodeId) -> f32where
    G: Visitable + NodeIndexable + IntoEdges + IntoNeighbors,
Expand description

Vertex eccentricity.

Calculate the eccentricity of a vertex node of the graph graph.

Examples

use graphalgs::metrics::eccentricity;
use petgraph::Graph;

let graph = Graph::<(), ()>::from_edges(&[(0, 1), (1, 0), (1, 2)]);

assert_eq!(eccentricity(&graph, 0.into()), 2.0);
assert_eq!(eccentricity(&graph, 1.into()), 1.0);
assert_eq!(eccentricity(&graph, 2.into()), f32::INFINITY);