Skip to main content

wheel_graph

Function wheel_graph 

Source
pub fn wheel_graph(n: u32, mode: WheelMode, center: u32) -> IgraphResult<Graph>
Expand description

Build a wheel graph on n vertices with the given center and arc policy mode.

See the module-level docs for the precise role of each mode and the degenerate two/three-vertex shapes.

§Errors

§Examples

use rust_igraph::{wheel_graph, WheelMode};

// Undirected wheel W6 (5 rim vertices around centre 0).
let w = wheel_graph(6, WheelMode::Undirected, 0).unwrap();
assert_eq!(w.vcount(), 6);
assert_eq!(w.ecount(), 2 * (6 - 1)); // 5 spokes + 5 rim edges
assert!(!w.is_directed());