Function graphalgs::metrics::center

source ·
pub fn center<G>(graph: G) -> Vec<G::NodeId>where
    G: Visitable + NodeIndexable + IntoEdges + IntoNodeIdentifiers,
Expand description

Central vertices of the graph.

Returns a vector of indices of the central vertices of the graph. Here, the central vertices are the vertices with the minimum eccentricity.

Examples

use graphalgs::metrics::center;
use petgraph::Graph;

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

assert_eq!(center(&graph), vec![1.into()]);