GraphPlot

GraphPlot[g]

generates a plot of the graph g.

GraphPlot[{e1,e2,}]

generates a plot of the graph with edges ei.

GraphPlot[{,w[ei],}]

plots ei with features defined by the symbolic wrapper w.

GraphPlot[{vi 1vj 1,}]

uses rules vikvjk to specify the graph g.

GraphPlot[m]

uses the adjacency matrix m to specify the graph g.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Plot a graph:

Plot a graph specified by edge rules:

Plot a graph specified by its adjacency matrix:

Scope  (11)

Graph Specification  (6)

Specify a graph using a graph:

Specify a graph using a rule list:

Specify a graph using a dense adjacency matrix:

Specify a graph using a sparse adjacency matrix:

Use GraphData for collections of graphs:

Use ExampleData for collections of sparse matrices:

Graph Styling  (5)

Give labels for some edges:

Give vertex labels:

Show edges as arrows:

Plot a disconnected graph using different packing methods:

For very large graphs, it is often better not to draw vertices at all:

Options  (71)

DataRange  (1)

Specify the range of vertex coordinates:

DirectedEdges  (1)

Show the direction of edges:

GraphLayout  (66)

"BalloonEmbedding"  (6)

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:

"BipartiteEmbedding"  (1)

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

"CircularEmbedding"  (2)

Place vertices on a circle:

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

"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:

"GridEmbedding"  (2)

Place vertices on a grid:

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

"HighDimensionalEmbedding"  (2)

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

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

"LayeredEmbedding"  (6)

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:

"LayeredDigraphEmbedding"  (3)

Place vertices in a series of layers:

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

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

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

Place vertices in concentric circles:

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

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

Place vertices on a spiral:

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

"SpringElectricalEmbedding"  (12)

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

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

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

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

Place vertices on a star shape:

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:

PlotStyle  (3)

Specify an overall style for the graph:

PlotStyle can be combined with VertexShapeFunction, which has higher priority:

PlotStyle can be combined with EdgeShapeFunction, which has higher priority:

Applications  (27)

Basic Applications  (3)

Label vertices and edges:

Plot a graph with "BalloonEmbedding":

Visualize large graphs:

Graph Theory  (5)

Plot a complete graph on 10 nodes:

Plot a random graph on 10 nodes:

A random graph with 1% of possible edges filled in:

A graph describing a simple relation:

Draw the graph of a random permutation:

Linguistic or Geographic Data  (3)

Generate a network of "nearby" words in a dictionary:

A word graph, with edges between adjacent letters in a word:

Show the adjacent countries in South America:

Number Properties  (11)

Numbers that have a common divisor:

Numbers that have no common divisor:

Link a number to another with a 1 bit inserted:

Link a number to another with a 0 bit inserted:

Link a number to another with 1 bit deleted:

Link a number to another that is one bit different:

Link a number to another that is one bit reversed:

Link a number to another that is one bit rotated right:

Link a number to another that is one bit rotated left:

Link a number to itself but with the last bit dropped:

Link a number to itself but with the first bit dropped:

Sparse Test Matrices  (3)

A sparse test matrix related to a structure from NASA's Langley Research Center:

A sparse test matrix related to a finite element model of a geodesic dome:

Use ArrayPlot or MatrixPlot to display sparse matrices:

Finite State Diagrams  (2)

A finite state diagram describing the C preprocessor:

A finite state diagram for string matching:

Properties & Relations  (8)

Use LayeredGraphPlot for hierarchical-style drawing of directed graphs:

Use TreePlot for different types of tree drawing:

Use GraphPlot3D to draw graphs in 3D:

Use GraphData for an extensive collection of predefined graphs and properties:

Get the connectivity and plot it:

Use VertexCoordinates to use the embedding provided by GraphData:

Use PolyhedronData for a large collection of polyhedra and properties:

Compare to a predefined embedding:

Use ExampleData for a large collection of sparse matrices:

Use GeoGraphValuePlot to show the values on geographic networks:

Use GeoGraphPlot to plot relationships between geographic locations on a map:

Wolfram Research (2007), GraphPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphPlot.html (updated 2019).

Text

Wolfram Research (2007), GraphPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphPlot.html (updated 2019).

CMS

Wolfram Language. 2007. "GraphPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/GraphPlot.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_graphplot, author="Wolfram Research", title="{GraphPlot}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/GraphPlot.html}", note=[Accessed: 18-July-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_graphplot, organization={Wolfram Research}, title={GraphPlot}, year={2019}, url={https://reference.wolfram.com/language/ref/GraphPlot.html}, note=[Accessed: 18-July-2024 ]}