GraphLayout

GraphLayout

is an option to Graph and related functions that specifies what layout to use.

Details

  • A graph layout is typically computed using several stages. With GraphLayout->{s1->m1,}, stage si is handled by method mi.
  • Possible graph layout stages are:
  • "VertexLayout"how to embed vertices
    "EdgeLayout"how to route edges
    "PackingLayout"how to place connected components of vertices
  • "VertexLayout" methods include:
  • Automaticautomatically select a layout
    Nonedo not compute a layout
  • Possible special embeddings include:
  • "BipartiteEmbedding"vertices on two parallel lines
    "CircularEmbedding"vertices on a circle
    "CircularMultipartiteEmbedding"vertices on segments of a circle
    "DiscreteSpiralEmbedding"vertices on a discrete spiral
    "GridEmbedding"vertices on a grid
    "LinearEmbedding"vertices on a line
    "MultipartiteEmbedding"vertices on several parallel lines
    "SpiralEmbedding"vertices on a 3D spiral projected to 2D
    "StarEmbedding"vertices on a circle with a center
  • Possible structured embeddings for layered graphs such as trees and directed acyclic graphs include:
  • "BalloonEmbedding"vertices on a circle with the center at the parent vertex
    "RadialEmbedding"vertices on a circular segment
    "LayeredDigraphEmbedding"vertices on parallel lines for directed acyclic graphs
    "LayeredEmbedding"vertices on parallel lines
  • Possible optimizing embeddings all minimize a quantity and include:
  • "GravityEmbedding"energy with vertices as mass points and edges as springs
    "HighDimensionalEmbedding"energy for spring-electrical in high dimension
    "PlanarEmbedding"number of edge crossings
    "SpectralEmbedding"weighted sum of squares distances
    "SpringElectricalEmbedding"energy with edges as springs and vertices as charges
    "SpringEmbedding"energy with edges as springs
    "TutteEmbedding"number of edge crossings and distance to neighbors
  • "EdgeLayout" methods include:
  • "DividedEdgeBundling"divide edges into segments bundle
    "HierarchicalEdgeBundling"bundle edges following a hierarchical tree structure
    "StraightLine"straight lines between edges
  • "PackingLayout" methods include:
  • "ClosestPacking"approximate closest packing from the top left
    "ClosestPackingCenter"approximate closest packing from the center
    "Layered"arrange in layers starting at the top left
    "LayeredLeft"arrange in layers starting at the left
    "LayeredTop"arrange in layers starting at the top
    "NestedGrid"arrange on a nested grid

Examples

open allclose all

Basic Examples  (2)

Graph layouts on particular curves:

Graph layouts that satisfy optimality criteria:

Scope  (96)

Basic Use  (3)

Change the default layout for Graph:

Graph3D:

TreeGraph:

PathGraph:

Lay out planar graphs:

Bipartite graphs:

Arbitrary graphs:

Specify a layout for parametric graphs:

Random graphs:

Matrix graphs:

Arbitrary graph constructors:

Vertex Layout  (84)

"BalloonEmbedding"  (7)

Place each vertex in an enclosing circle centered at its parent vertex:

"BalloonEmbedding" works best for tree graphs:

Use the option "EvenAngle"->True to place vertices evenly in an enclosing circle:

With the setting "OptimalOrder"->True, the vertex ordering optimizes the angular resolution and the aspect ratio:

Use the option "RootVertex"->v to set the root vertex:

Use "SectorAngles"->s to control the size of each sector:

The balloon layout works with arbitrary graphs:

"BipartiteEmbedding"  (2)

Place vertices on two vertical lines based on a bipartite partition:

"BipartiteEmbedding" works for bipartite graphs only:

"CircularEmbedding"  (3)

Place vertices on a circle:

Use the option "Offset"->offset to specify the offset angles:

With the setting "OptimalOrder"->True, vertices are reordered so that they lie nicely on a circle:

"CircularMultipartiteEmbedding"  (2)

Place vertices on polygon lines based on a vertex partition:

Use "VertexPartition"->partition to specify a partition of vertices:

"DiscreteSpiralEmbedding"  (3)

Place vertices on a discrete spiral:

"DiscreteSpiralEmbedding" works best for path graphs:

With the setting "OptimalOrder"->True, vertices are reordered so that they lie nicely on a discrete spiral:

"GravityEmbedding"  (2)

Place vertices so that they minimize mechanical, electrical and gravitational energy when each vertex has a charge and a mass, and each edge corresponds to a spring:

Use the option "RootVertex"->v to set the root vertex:

"GridEmbedding"  (2)

Place vertices on a grid:

Use "Dimension"->dim to specify a dimension of a grid:

"HighDimensionalEmbedding"  (3)

Place vertices in high dimension according to spring-electrical embedding and project down:

"HighDimensionalEmbedding" works best for large graphs:

Use "RandomSeed"->int to specify a seed for the random number generator that computes the initial vertex placement:

"LayeredEmbedding"  (7)

Place vertices in several layers in such a way as to minimize edges between nonadjacent layers:

"LayeredEmbedding" works best for tree graphs:

Use the option "LayerSizeFunction"->func to specify the relative height:

Use the option "RootVertex"->v to set the root vertex:

Use the option "LeafDistance"->d to specify the leaf distance:

Use the option "Orientation"->o to draw a tree with different orientations:

The layered drawing works on arbitrary graphs:

"LayeredDigraphEmbedding"  (5)

Place vertices in a series of layers:

"LayeredDigraphEmbedding" works best for directed acyclic graphs:

Use the option "RootVertex"->v to set the root vertex:

Use the option "Orientation"->o to draw a tree with different orientations:

The layered digraph drawing works on arbitrary graphs:

"LinearEmbedding"  (2)

Place vertices on a line:

Use the option "Method"->m to specify the algorithm:

"MultipartiteEmbedding"  (2)

Place vertices on multiple line grids based on a vertex partition:

Use "VertexPartition"->partition to specify a partition of vertices:

"PlanarEmbedding"  (1)

Place vertices on a plane without an edge crossing:

"RadialEmbedding"  (4)

Place vertices in concentric circles:

"RadialEmbedding" works best for tree graphs:

Use the option "RootVertex"->v to set the root vertex:

The radial drawing works on arbitrary graphs:

"RandomEmbedding"  (1)

Place vertices randomly:

"SpectralEmbedding"  (2)

Place vertices so the weighted sum of squares of mutual distances is minimized:

Use the option "RelaxationFactor"->r to get the layout based on a relaxed Laplace matrix:

"SpiralEmbedding"  (3)

Place vertices on a spiral:

"SpiralEmbedding" works best for path graphs:

With the setting "OptimalOrder"->True, vertices are reordered so that they lie on the spiral nicely:

"SpringElectricalEmbedding"  (14)

Place vertices so that they minimize mechanical and electrical energy when each vertex has a charge and each edge corresponds to a spring:

"SpringElectricalEmbedding" works best for most graphs:

With the setting "EdgeWeighted"->True, edge weights are used:

Use the option "EnergyControl"->e to specify limitations on the total energy of the system during minimization:

Use "InferentialDistance"->d to specify a cutoff distance beyond which the interaction between vertices is assumed to be nonexistent:

Use "MaxIteration"->it to specify a maximum number of iterations to be used in attempting to minimize the energy:

Use "Multilevel"->method to specify a method used during a recursive procedure of coarsening a graph:

With the setting "Octree"->True, an octree data structure (in three dimensions) or a quadtree data structure (in two dimensions) is used in the calculation of repulsive force:

Use "RandomSeed"->int to specify a seed for the random number generator that computes the initial vertex placement:

Use "RepulsiveForcePower"->r to control how fast the repulsive force decays over distance:

Use "SpringConstant"r to control the constant in the attractive force:

Use "StepControl"->method to define how step length is modified during energy minimization:

Use "StepLength"->r to specify the initial step length used in moving the vertices around:

Use "Tolerance"->r to specify the tolerance used in terminating the energy minimization process:

"SpringEmbedding"  (11)

Place vertices so that they minimize mechanical energy when each edge corresponds to a spring:

"SpringEmbedding" works best for regular structured graphs:

With the setting "EdgeWeighted"->True, edge weights are used:

Use the option "EnergyControl"->e to specify limitations on the total energy of the system during minimization:

Use "InferentialDistance"->d to specify a cutoff distance beyond which the interaction between vertices is assumed to be nonexistent:

Use "MaxIteration"->it to specify a maximum number of iterations to be used in attempting to minimize the energy:

Use "Multilevel"->method to specify a method used during a recursive procedure of coarsening a graph:

Use "RandomSeed"->int to specify a seed for the random number generator that computes the initial vertex placement:

Use "StepControl"->method to define how step length is modified during energy minimization:

Use "StepLength"->r to specify the initial step length used in moving the vertices around:

Use "Tolerance"->r to specify the tolerance used in terminating the energy minimization process:

"StarEmbedding"  (4)

Place vertices on a star shape:

"StarEmbedding" works best for star-like graphs:

Use the option "Offset"->offset to specify the offset angles:

Use the option "Center"->center to specify the center:

"TutteEmbedding"  (2)

Place vertices without crossing edges and minimize the sum of distances to neighbors:

"TutteEmbedding" works for 3-connected planar graphs only:

None  (2)

Print the elided form of a graph:

Useful for large graphs:

Packing Layout  (6)

"ClosestPacking"  (1)

Approximate closest packing from the top left:

"ClosestPackingCenter"  (1)

Approximate closest packing from the center:

"Layered"  (1)

Arrange in layers starting at the top left:

"LayeredLeft"  (1)

Arrange in layers starting at the left:

"LayeredTop"  (1)

Arrange in layers starting at the top:

"NestedGrid"  (1)

Arrange on a nested grid:

Rendering Order  (3)

"VertexFirst"  (1)

Place vertices on the top of edges:

"EdgeFirst"  (1)

Place edges on the top of vertices:

Ordering  (1)

Place vertices and edges by the specified order:

Applications  (2)

Layout of Wolfram System installation directory:

Show the relationships between early versions of the Unix operating system:

Automatically use the layered digraph embedding:

Properties & Relations  (6)

GraphLayout can be used for general graphs:

Matrix graphs:

Special graphs:

Random graphs:

VertexCoordinates overrides GraphLayout coordinates:

Use AbsoluteOptions to extract VertexCoordinates computed using a layout algorithm:

Introduced in 2010
 (8.0)
 |
Updated in 2012
 (9.0)
2014
 (10.0)
2019
 (12.0)