pub fn radius<G>(graph: G) -> Option<f32>where
G: Visitable + NodeIndexable + IntoEdges + IntoNeighbors + IntoNodeIdentifiers + NodeCount,
Expand description
Graph radius.
Calculate the radius of a graph graph
.
Returns Option<f32>
, None
will be in case there are no vertices in the graph.
If the graph radius is infinity, then the result of the algorithm will be f32::INFINITY
.
Examples
use graphalgs::metrics::radius;
use petgraph::Graph;
let graph = Graph::<(), ()>::from_edges(&[(0, 1), (1, 0), (1, 2)]);
assert_eq!(radius(&graph), Some(1.0));