GraphLayout

Listing of Layouts »

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 si 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
    "emb"named embedding
  • Possible special embeddings "emb" 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 "emb" 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 "emb" 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
    "SphericalEmbedding"energy with vertices on a sphere and edges as springs
    "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  (113)

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  (98)

"BalloonEmbedding"  (8)

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 the option "Rotation"->r to rotate the layout:

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"  (4)

Place vertices on a circle:

"CircularEmbedding" works best for circulant graphs, LCF notation embeddings and cycle graphs:

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"  (3)

Place vertices on polygon lines based on a vertex partition:

"CircularMultipartiteEmbedding" works best for k-partite graphs:

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"  (3)

Place vertices on a grid:

"GridEmbedding" works best for grid graphs:

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"  (7)

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 "Rotation"r to rotate the layout:

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

Use the option "VertexLayerPosition"->positions to specify the positions of layers:

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"  (3)

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

"MultipartiteEmbedding" works best for k-partite graphs:

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

"PlanarEmbedding"  (2)

Place vertices on a plane without an edge crossing:

"PlanarEmbedding" works for planar graphs only:

"RadialEmbedding"  (5)

Place vertices in concentric circles:

"RadialEmbedding" works best for tree graphs:

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

Use the option "Rotation"r to rotate the layout:

The radial drawing works on arbitrary graphs:

"RandomEmbedding"  (1)

Place vertices randomly:

"SpectralEmbedding"  (3)

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

"SpectralEmbedding" works best for well-structured graphs:

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

"SphericalEmbedding"  (2)

Place vertices on a sphere:

"SphericalEmbedding" works best for regular structured graphs:

"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"  (15)

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 the option "Rotation"r to rotate the layout:

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"  (12)

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 the option "Rotation"r to rotate the layout:

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:

Edge Layout  (3)

"DividedEdgeBundling"  (1)

Divide edges into segments bundle:

"HierarchicalEdgeBundling"  (1)

Bundle edges following a hierarchical tree structure:

"StraightLine"  (1)

Straight lines between edges:

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:

Wolfram Research (2010), GraphLayout, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphLayout.html (updated 2021).

Text

Wolfram Research (2010), GraphLayout, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphLayout.html (updated 2021).

CMS

Wolfram Language. 2010. "GraphLayout." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/GraphLayout.html.

APA

Wolfram Language. (2010). GraphLayout. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphLayout.html

BibTeX

@misc{reference.wolfram_2024_graphlayout, author="Wolfram Research", title="{GraphLayout}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/GraphLayout.html}", note=[Accessed: 04-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_graphlayout, organization={Wolfram Research}, title={GraphLayout}, year={2021}, url={https://reference.wolfram.com/language/ref/GraphLayout.html}, note=[Accessed: 04-November-2024 ]}