Layout
Compute 2D or 3D coordinates for vertices so the graph can be drawn. Layout algorithms do not change the graph structure; they only produce positions.
| Algorithm | When to use |
|---|---|
Starting point. Assigns random positions. Often used to seed a force-directed layout. |
|
Places vertices evenly on a circle. Good for small graphs or ring topologies. |
|
Spring model based on graph-theoretic distances. Produces aesthetically pleasing layouts for small to medium graphs (< ~1000 vertices). |
|
Force-directed. Scales better than Kamada-Kawai. Good for medium graphs. |
|
Topology-based layout using self-organizing maps. Works on arbitrary topologies (sphere, torus, etc.). |
| For most graphs, start with a random layout and then run Fruchterman-Reingold or Kamada-Kawai. Kamada-Kawai produces better results but is slower; Fruchterman-Reingold is faster and handles larger graphs. |
All layout algorithms write positions into a property map. The topology
(rectangle, circle, sphere, heart, etc.) is specified via a topology object;
see Topologies for Graph Drawing for
the catalog of built-in types (square_topology, cube_topology,
ball_topology, sphere_topology, heart_topology, …) and the concept a
custom topology must model.