Skip to main content

is_simple_with_mode

Function is_simple_with_mode 

Source
pub fn is_simple_with_mode(
    graph: &Graph,
    mode: SimpleMode,
) -> IgraphResult<bool>
Expand description

is_simple with explicit SimpleMode (ALGO-PR-013b).

On undirected graphs both modes are equivalent. On directed graphs SimpleMode::DirectedAsUndirected returns false whenever a mutual pair {a → b, b → a} exists (treated as a multi-edge in the undirected view).

§Examples

use rust_igraph::{Graph, is_simple_with_mode, SimpleMode};

// Mutual directed pair: simple in directed mode, NOT simple as
// undirected (would be a doubled undirected edge).
let mut g = Graph::new(2, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 0).unwrap();
assert!(is_simple_with_mode(&g, SimpleMode::DirectedAsDirected).unwrap());
assert!(!is_simple_with_mode(&g, SimpleMode::DirectedAsUndirected).unwrap());