pub fn is_unicyclic(graph: &Graph) -> IgraphResult<bool>Expand description
Check whether a graph is unicyclic.
A unicyclic graph is connected and has exactly as many edges as vertices (n vertices, n edges), which means it contains exactly one cycle.
Returns false for directed graphs, disconnected graphs, trees
(n-1 edges), and graphs with more than one cycle.
ยงExamples
use rust_igraph::{Graph, is_unicyclic};
// Triangle with a tail: 0-1-2-0, 2-3
let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
g.add_edge(2, 3).unwrap();
assert!(is_unicyclic(&g).unwrap());
// Path is NOT unicyclic (no cycle)
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert!(!is_unicyclic(&g).unwrap());