pub fn ring_graph(
n: u32,
directed: bool,
mutual: bool,
circular: bool,
) -> IgraphResult<Graph>Expand description
Lay n vertices in a sequence and join them; close the loop iff
circular.
See the module-level docs for the precise role of each flag.
§Errors
Returns IgraphError::Internal if the implied edge count would
overflow usize — only reachable on 32-bit targets with absurdly
large n.
§Examples
use rust_igraph::ring_graph;
// Undirected cycle on 5 vertices.
let c5 = ring_graph(5, false, false, true).unwrap();
assert_eq!(c5.vcount(), 5);
assert_eq!(c5.ecount(), 5);
// Open path on 4 vertices, no wrap-around.
let p4 = ring_graph(4, false, false, false).unwrap();
assert_eq!(p4.ecount(), 3);