Skip to main content

layout_star

Function layout_star 

Source
pub fn layout_star(
    graph: &Graph,
    center: u32,
    order: Option<&[u32]>,
) -> IgraphResult<Vec<(f64, f64)>>
Expand description

Place vertices in a star layout: center at origin, rest on a unit circle.

§Parameters

  • center: vertex id to place at the origin.
  • order: optional ordering of vertices. If None, vertices are placed in vertex-ID order.

§Examples

use rust_igraph::{Graph, layout_star};

let g = Graph::with_vertices(5);
let coords = layout_star(&g, 0, None).unwrap();
assert_eq!(coords.len(), 5);
// Center vertex is at origin
assert!((coords[0].0).abs() < 1e-9);
assert!((coords[0].1).abs() < 1e-9);