Skip to main content

star_graph

Function star_graph 

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

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

See the module-level docs for the precise role of each mode.

§Errors

§Examples

use rust_igraph::{star_graph, StarMode};

// Undirected star with 5 leaves around vertex 0.
let s = star_graph(6, StarMode::Undirected, 0).unwrap();
assert_eq!(s.vcount(), 6);
assert_eq!(s.ecount(), 5);
assert!(!s.is_directed());