pub fn layout_drl_3d(
graph: &Graph,
seed: Option<&[[f64; 3]]>,
options: &DrlOptions,
weights: Option<&[f64]>,
) -> IgraphResult<Vec<[f64; 3]>>Expand description
Compute the DrL layout in 3D.
The 3D variant of DrL uses a smaller density grid (100³ vs 400² for 2D) to keep memory usage practical.
§Arguments
graph— input graph (treated as undirected).seed— optional initial positions. IfNone, random positions are generated.options— algorithm parameters (useDrlOptions::default()orDrlOptions::from_template(...)for presets).weights— optional edge weights (must be positive).
Returns [x, y, z] positions for each vertex.
§Errors
Returns InvalidArgument if weights contain non-positive values,
or if seed length doesn’t match vertex count.
§Examples
use rust_igraph::{Graph, layout_drl_3d, DrlOptions, DrlTemplate};
let mut g = Graph::with_vertices(6);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
g.add_edge(3, 4).unwrap();
g.add_edge(4, 5).unwrap();
let options = DrlOptions::from_template(DrlTemplate::Default);
let pos = layout_drl_3d(&g, None, &options, None).unwrap();
assert_eq!(pos.len(), 6);
assert!(pos.iter().all(|p| p[0].is_finite() && p[1].is_finite() && p[2].is_finite()));