Skip to main content

layout_reingold_tilford_circular

Function layout_reingold_tilford_circular 

Source
pub fn layout_reingold_tilford_circular(
    graph: &Graph,
    root: Option<VertexId>,
    mode: RtMode,
) -> IgraphResult<Vec<[f64; 2]>>
Expand description

Circular variant of the Reingold-Tilford layout.

First computes the standard RT layout, then maps X to angle and Y to radius in polar coordinates. The root ends up at the center.

ยงExamples

use rust_igraph::{Graph, layout_reingold_tilford_circular, RtMode};

let mut g = Graph::with_vertices(7);
for &(u, v) in &[(0,1),(0,2),(1,3),(1,4),(2,5),(2,6)] {
    g.add_edge(u, v).unwrap();
}

let pos = layout_reingold_tilford_circular(&g, Some(0), RtMode::All).unwrap();
assert_eq!(pos.len(), 7);