pub fn layout_grid(graph: &Graph, width: i32) -> Vec<(f64, f64)>Expand description
Place vertices on a regular 2D grid.
When width is 0 or negative, the grid width is
ceil(sqrt(vcount)).
ยงExamples
use rust_igraph::{Graph, layout_grid};
let g = Graph::with_vertices(6);
let coords = layout_grid(&g, 3);
assert_eq!(coords.len(), 6);
// First row: (0,0), (1,0), (2,0)
assert!((coords[0].0).abs() < 1e-9);
assert!((coords[1].0 - 1.0).abs() < 1e-9);
assert!((coords[2].0 - 2.0).abs() < 1e-9);
// Second row: (0,1), (1,1), (2,1)
assert!((coords[3].1 - 1.0).abs() < 1e-9);