diameter

Function diameter 

Source
pub fn diameter<G>(graph: G) -> Option<f32>
Expand description

Graph diameter.

Calculate the diameter of a graph graph. Returns Option<f32>, None will be in case there are no vertices in the graph. If the graph diameter is infinity, then the result of the algorithm will be f32::INFINITY.

ยงExamples

use graphalgs::metrics::diameter;
use petgraph::Graph;

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

assert_eq!(diameter(&graph), Some(f32::INFINITY));