Skip to main content

layout_fruchterman_reingold_3d

Function layout_fruchterman_reingold_3d 

Source
pub fn layout_fruchterman_reingold_3d(
    graph: &Graph,
    params: &FrParams3d,
) -> IgraphResult<Vec<(f64, f64, f64)>>
Expand description

3D Fruchterman-Reingold force-directed layout.

Same algorithm as the 2D version but in three dimensions. No grid acceleration is available for 3D.

ยงExamples

use rust_igraph::{Graph, layout_fruchterman_reingold_3d, FrParams3d};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();

let coords = layout_fruchterman_reingold_3d(&g, &FrParams3d::default()).unwrap();
assert_eq!(coords.len(), 4);