Skip to main content

is_simple

Function is_simple 

Source
pub fn is_simple(graph: &Graph) -> IgraphResult<bool>
Expand description

Returns true if graph has neither self-loops nor parallel edges.

Empty / no-edge graphs return true (vacuously simple).

§Examples

use rust_igraph::{Graph, is_simple};

let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert!(is_simple(&g).unwrap());

// Add a parallel edge → no longer simple.
g.add_edge(0, 1).unwrap();
assert!(!is_simple(&g).unwrap());