({{, (RefLink[GraphPlot3D, paclet:ref/GraphPlot3D])[g]
generates a 3D plot of the graph g.}, {, (RefLink[GraphPlot3D, paclet:ref/GraphPlot3D])[{(Subscript[e, 1]),(Subscript[e, 2]),…}]
generates a 3D plot of the graph with edges (Subscript[e, i]).}, {, (RefLink[GraphPlot3D, paclet:ref/GraphPlot3D])[{…,w[(Subscript[e, i])],…}]
plots (Subscript[e, i]) with features defined by the symbolic wrapper w.}, {, (RefLink[GraphPlot3D, paclet:ref/GraphPlot3D])[{(Subscript[v, i1])->(Subscript[v, j1]),…}]
uses rules (Subscript[v, ik])->(Subscript[v, jk]) to specify the graph g.}, {, (RefLink[GraphPlot3D, paclet:ref/GraphPlot3D])[m]
uses the adjacency matrix m to specify the graph g.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[GraphPlot3D, paclet:ref/GraphPlot3D]) attempts to place vertices in 3D to give a well laid-out version of the graph.

(RefLink[GraphPlot3D, paclet:ref/GraphPlot3D]) supports the same vertices, edges and wrappers as (RefLink[Graph, paclet:ref/Graph]).

The following special wrappers can be used for the edges (Subscript[e, i]):

(RefLink[GraphPlot3D, paclet:ref/GraphPlot3D]) has the same options as (RefLink[Graphics3D, paclet:ref/Graphics3D]), with the following additions and changes:

With the setting (RefLink[VertexCoordinates, paclet:ref/VertexCoordinates])->(RefLink[Automatic, paclet:ref/Automatic]), the embedding of vertices and routing of edges is computed automatically, based on the setting for (RefLink[GraphLayout, paclet:ref/GraphLayout]).

Possible special embeddings for (RefLink[GraphLayout, paclet:ref/GraphLayout]) include:

Possible structured embeddings for layered graphs such as trees and directed acyclic graphs include:

Possible optimizing embeddings all minimize a quantity and include:

Possible settings for (RefLink[PlotTheme, paclet:ref/PlotTheme]) include common base themes, color feature themes, font features themes, and size features themes.

Graph features themes affect plot of vertices and edges. Feature themes include:

OpenersPrimaryExamplesSection(Spacer1)Examples  (95)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Plot a graph in 3D:

GraphPlot3D[ButterflyGraph[2]]

Plot a graph specified by edge rules:

GraphPlot3D[{1->2,2->3,3->4,4->1,4->5,5->1,2->5,3->5}]

Plot a graph specified by its adjacency matrix:

GraphPlot3D[{{0,1,1,1},{1,0,1,1},{1,1,0,1},{1,1,1,0}}]

OpenersExampleSection1(Spacer1)Scope  (12)

OpenersExampleSubsection0(Spacer1)Graph Specification  (6)

Specify a graph using a graph:

GraphPlot3D[Graph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]4,4\[UndirectedEdge]1,2\[UndirectedEdge]4}]]

Specify a graph using a rule list:

GraphPlot3D[{1->2,2->3,3->4,4->1,2->4}]

Specify a graph using a dense adjacency matrix:

GraphPlot3D[{{0,1,0,0},{0,0,1,1},{0,0,0,1},{1,0,0,0}}]

Specify a graph using a sparse adjacency matrix:

GraphPlot3D[SparseArray[{{1,2},{2,3},{3,4},{4,1},{2,4}}->1,{4,4}]]

Use (RefLink[GraphData, paclet:ref/GraphData]) for collections of graphs:

Table[GraphPlot3D[GraphData[g,"EdgeRules"]],{g,{{"GeneralizedPetersen",{9,2}},"ClebschGraph","TesseractGraph"}}]

Use (RefLink[ExampleData, paclet:ref/ExampleData]) for collections of sparse matrices:

GraphPlot3D[ExampleData[{"Matrix","Bai/dwa512"},"Matrix"]]

OpenersExampleSubsection1(Spacer1)Graph Styling  (6)

Give labels for some edges:

GraphPlot3D[{1->2,Labeled[2->3,"23"],3->1,2->4,2->5}]

Give vertex labels:

GraphPlot3D[{5->4,6->2,6->3,6->5,4->5,7->1,7->3,7->4,7->6},VertexLabels->"Name"]

Show edges as arrows:

GraphPlot3D[{1->2,2->3,3->1},DirectedEdges->True]

Plot a disconnected graph using different packing methods:

Table[Framed@GraphPlot3D[Table[i->Mod[i^2,102],{i,0,102}],GraphLayout->{"PackingLayout"->pm}],{pm,{Automatic,"ClosestPacking"}}]

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

GraphPlot3D[Table[i->Mod[i^2,500],{i,500}],VertexShapeFunction->None]

Use (RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]) and (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) for detailed control:

GraphPlot3D[{1->2,2->3,3->4,4->1,4->5,5->1,2->5,3->5},EdgeShapeFunction->(Cylinder[#1,.05]&),VertexShapeFunction->(Sphere[#1,.1]&)]

OpenersExampleSection2(Spacer1)Options  (71)

OpenersExampleSubsection2(Spacer1)DataRange  (1)

Specify the range of vertex coordinates:

GraphPlot3D[RandomGraph[{10,15}], DataRange->{{0,1},{0,2}, {0,1}}]

OpenersExampleSubsection3(Spacer1)DirectedEdges  (1)

Show the direction of edges:

GraphPlot3D[{1->2,2->3,3->4,4->1,2->4},DirectedEdges-> True]

OpenersExampleSubsection4(Spacer1)GraphLayout  (66)

OpenersExampleSubsubsection0(Spacer1)"BalloonEmbedding"  (6)

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

GraphPlot3D[Table[Floor[j/12]\[UndirectedEdge]j,{j,1, 30}],GraphLayout->"BalloonEmbedding"]

"BalloonEmbedding" works best for tree graphs:

GraphPlot3D[RandomInteger[{1,#}] \[UndirectedEdge] # + 1 & /@ Range[30], GraphLayout->"BalloonEmbedding"]

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

GraphPlot3D[KaryTree[48,5],GraphLayout->{"BalloonEmbedding", "EvenAngle"->#}]&/@{True,False}

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

GraphPlot3D[KaryTree[48,5],GraphLayout->{"BalloonEmbedding", "OptimalOrder"->#}]&/@{True,False}

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

GraphPlot3D[KaryTree[48,5],GraphLayout->{"BalloonEmbedding", "RootVertex"->#}]&/@{1,2}

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

GraphPlot3D[KaryTree[48,5],GraphLayout->{"BalloonEmbedding", "SectorAngles"->{1->Pi/2}}]

OpenersExampleSubsubsection1(Spacer1)"BipartiteEmbedding"  (1)

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

GraphPlot3D[Table[i\[UndirectedEdge]Mod[i+1,5],{i,8}],GraphLayout->"BipartiteEmbedding"]

OpenersExampleSubsubsection2(Spacer1)"CircularEmbedding"  (2)

Place vertices on a circle:

GraphPlot3D[Table[i\[UndirectedEdge]Mod[i+1,3],{i,8}],GraphLayout->"CircularEmbedding"]

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

GraphPlot3D[CompleteGraph[7],GraphLayout->{"CircularEmbedding", "Offset"->#}]&/@{Automatic,{30 Degree, 30 Degree},{50 Degree, 80 Degree}}

OpenersExampleSubsubsection3(Spacer1)"CircularMultipartiteEmbedding"  (2)

Place vertices on polygon lines based on a vertex partition:

GraphPlot3D[Flatten[Table[i\[UndirectedEdge]j,{i,4},{j,5,8}]],GraphLayout->{"CircularMultipartiteEmbedding", "VertexPartition"->{2,3,3}}]

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

GraphPlot3D[CompleteGraph[{3,3,2}],GraphLayout->{"CircularMultipartiteEmbedding", "VertexPartition"->{3,3,2}}]

OpenersExampleSubsubsection4(Spacer1)"DiscreteSpiralEmbedding"  (3)

Place vertices on a discrete spiral:

GraphPlot3D[Table[i\[UndirectedEdge]i+1,{i,11}],GraphLayout-> "DiscreteSpiralEmbedding"]

"DiscreteSpiralEmbedding" works best for path graphs:

GraphPlot3D[PathGraph[Range[30]],GraphLayout->"DiscreteSpiralEmbedding"]

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

edges=RandomSample[EdgeList[PathGraph[Range[20]]],19];
{GraphPlot3D[edges,GraphLayout->{"DiscreteSpiralEmbedding","OptimalOrder"->True}],
GraphPlot3D[edges,GraphLayout->{"DiscreteSpiralEmbedding","OptimalOrder"->False}]}

OpenersExampleSubsubsection5(Spacer1)"GridEmbedding"  (2)

Place vertices on a grid:

GraphPlot3D[GridGraph[{5,5}],GraphLayout->"GridEmbedding"]

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

GraphPlot3D[GridGraph[{12,12}],GraphLayout->{"GridEmbedding","Dimension"->{12,12}}]

OpenersExampleSubsubsection6(Spacer1)"HighDimensionalEmbedding"  (2)

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

GraphPlot3D[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]5,1\[UndirectedEdge]9,2\[UndirectedEdge]4,2\[UndirectedEdge]6,2\[UndirectedEdge]10,3\[UndirectedEdge]4,3\[UndirectedEdge]7,3\[UndirectedEdge]11,4\[UndirectedEdge]8,4\[UndirectedEdge]12,5\[UndirectedEdge]6,5\[UndirectedEdge]7,5\[UndirectedEdge]13,6\[UndirectedEdge]8,6\[UndirectedEdge]14,7\[UndirectedEdge]8,7\[UndirectedEdge]15,8\[UndirectedEdge]16,9\[UndirectedEdge]10,9\[UndirectedEdge]11,9\[UndirectedEdge]13,10\[UndirectedEdge]12,10\[UndirectedEdge]14,11\[UndirectedEdge]12,11\[UndirectedEdge]15,12\[UndirectedEdge]16,13\[UndirectedEdge]14,13\[UndirectedEdge]15,14\[UndirectedEdge]16,15\[UndirectedEdge]16},GraphLayout->"HighDimensionalEmbedding"]

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

edge={1\[UndirectedEdge]3,1\[UndirectedEdge]5,1\[UndirectedEdge]7,2\[UndirectedEdge]3,2\[UndirectedEdge]6,2\[UndirectedEdge]7,2\[UndirectedEdge]8,3\[UndirectedEdge]4,3\[UndirectedEdge]8,4\[UndirectedEdge]6,5\[UndirectedEdge]8,7\[UndirectedEdge]8};

GraphPlot3D[edge,GraphLayout->{"HighDimensionalEmbedding","RandomSeed"->#}]&/@{1,50}

OpenersExampleSubsubsection7(Spacer1)"LayeredEmbedding"  (6)

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

GraphPlot3D[Table[i\[UndirectedEdge]Mod[i+1,5],{i,12}], GraphLayout->"LayeredEmbedding"]

"LayeredEmbedding" works best for tree graphs:

GraphPlot3D[RandomInteger[{1,#}] \[UndirectedEdge] # + 1 & /@ Range[20], GraphLayout->"LayeredEmbedding"]

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

GraphPlot3D[KaryTree[10,3],GraphLayout->{"LayeredEmbedding", LayerSizeFunction->(2&)}]

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

GraphPlot3D[KaryTree[10,3],GraphLayout->{"LayeredEmbedding", "RootVertex"->#}]&/@{1,4}

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

GraphPlot3D[KaryTree[10,3],GraphLayout->{"LayeredEmbedding", "LeafDistance"->#}]&/@{1,2}

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

Table[GraphPlot3D[KaryTree[6,3],GraphLayout->{"LayeredEmbedding", "Orientation"->o}],{o,{Top,Bottom,Left,Right}}]

OpenersExampleSubsubsection8(Spacer1)"LayeredDigraphEmbedding"  (3)

Place vertices in a series of layers:

GraphPlot3D[{1\[DirectedEdge]2,1\[DirectedEdge]3,2\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]4,1\[DirectedEdge]5}, GraphLayout->"LayeredDigraphEmbedding"]

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

GraphPlot3D[{1\[DirectedEdge]2,1\[DirectedEdge]3,2\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]4,1\[DirectedEdge]5},GraphLayout->{"LayeredDigraphEmbedding", "RootVertex"->#}]&/@{1,3}

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

Table[GraphPlot3D[{1\[DirectedEdge]2,1\[DirectedEdge]3,2\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]4,1\[DirectedEdge]5},GraphLayout->{"LayeredDigraphEmbedding", "Orientation"->o}],{o,{Top,Bottom,Left,Right}}]

OpenersExampleSubsubsection9(Spacer1)"LinearEmbedding"  (2)

Place vertices on a line:

GraphPlot3D[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]4},GraphLayout->"LinearEmbedding"]

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

Table[GraphPlot3D[CompleteGraph[4],GraphLayout->{"LinearEmbedding", Method->m}],{m,{"Spectral","SpectralOrdering","TwoNormApproximation","TwoNormApproximationOrdering"}}]

OpenersExampleSubsubsection10(Spacer1)"MultipartiteEmbedding"  (2)

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

GraphPlot3D[Flatten[Table[i\[UndirectedEdge]j,{i,3},{j,4,8}]],GraphLayout->{"MultipartiteEmbedding", "VertexPartition"->{2,1,3,2}}]

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

GraphPlot3D[CompleteGraph[{3,2,4}],GraphLayout->{"MultipartiteEmbedding", "VertexPartition"->{3,2,4}}]

OpenersExampleSubsubsection11(Spacer1)"PlanarEmbedding"  (1)

Place vertices on a plane without an edge crossing:

GraphPlot3D[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},GraphLayout->"PlanarEmbedding"]

OpenersExampleSubsubsection12(Spacer1)"RadialEmbedding"  (2)

Place vertices in concentric circles:

GraphPlot3D[Table[Floor[j/7]\[UndirectedEdge]j,{j,1, 30}], GraphLayout->"RadialEmbedding"]

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

GraphPlot3D[KaryTree[60,5],GraphLayout->{"RadialEmbedding", "RootVertex"->#}]&/@{1,2}

OpenersExampleSubsubsection13(Spacer1)"RandomEmbedding"  (1)

Place vertices randomly:

GraphPlot3D[Table[i\[UndirectedEdge]Mod[i+1,10],{i,30}],GraphLayout->"RandomEmbedding"]

OpenersExampleSubsubsection14(Spacer1)"SpectralEmbedding"  (2)

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

GraphPlot3D[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]5,1\[UndirectedEdge]9,2\[UndirectedEdge]4,2\[UndirectedEdge]6,2\[UndirectedEdge]10,3\[UndirectedEdge]4,3\[UndirectedEdge]7,3\[UndirectedEdge]11,4\[UndirectedEdge]8,4\[UndirectedEdge]12,5\[UndirectedEdge]6,5\[UndirectedEdge]7,5\[UndirectedEdge]13,6\[UndirectedEdge]8,6\[UndirectedEdge]14,7\[UndirectedEdge]8,7\[UndirectedEdge]15,8\[UndirectedEdge]16,9\[UndirectedEdge]10,9\[UndirectedEdge]11,9\[UndirectedEdge]13,10\[UndirectedEdge]12,10\[UndirectedEdge]14,11\[UndirectedEdge]12,11\[UndirectedEdge]15,12\[UndirectedEdge]16,13\[UndirectedEdge]14,13\[UndirectedEdge]15,14\[UndirectedEdge]16,15\[UndirectedEdge]16},GraphLayout->"SpectralEmbedding"]

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

Table[GraphPlot3D[GridGraph[{10,10}], GraphLayout->{"SpectralEmbedding", "RelaxationFactor"->i}],{i,0,1,.3}]

OpenersExampleSubsubsection15(Spacer1)"SpiralEmbedding"  (2)

Place vertices on a spiral:

GraphPlot3D[Table[i\[UndirectedEdge]Mod[i+1,20,1],{i,20}],GraphLayout->"SpiralEmbedding"]

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

edges=RandomSample[EdgeList[CycleGraph[20]],20];
GraphPlot3D[edges,GraphLayout->{"SpiralEmbedding","OptimalOrder"->#}]&/@{True,False}

OpenersExampleSubsubsection16(Spacer1)"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:

GraphPlot3D[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]5,1\[UndirectedEdge]9,2\[UndirectedEdge]4,2\[UndirectedEdge]6,2\[UndirectedEdge]10,3\[UndirectedEdge]4,3\[UndirectedEdge]7,3\[UndirectedEdge]11,4\[UndirectedEdge]8,4\[UndirectedEdge]12,5\[UndirectedEdge]6,5\[UndirectedEdge]7,5\[UndirectedEdge]13,6\[UndirectedEdge]8,6\[UndirectedEdge]14,7\[UndirectedEdge]8,7\[UndirectedEdge]15,8\[UndirectedEdge]16,9\[UndirectedEdge]10,9\[UndirectedEdge]11,9\[UndirectedEdge]13,10\[UndirectedEdge]12,10\[UndirectedEdge]14,11\[UndirectedEdge]12,11\[UndirectedEdge]15,12\[UndirectedEdge]16,13\[UndirectedEdge]14,13\[UndirectedEdge]15,14\[UndirectedEdge]16,15\[UndirectedEdge]16},GraphLayout->"SpringElectricalEmbedding"]

With the setting "EdgeWeighted"->(RefLink[True, paclet:ref/True]), edge weights are used:

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,10];
weight=RandomInteger[{1,5},11];

GraphPlot3D[edge,EdgeWeight->weight,GraphLayout->{"SpringElectricalEmbedding", "EdgeWeighted"->#}]&/@{True, False}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,{GraphLayout->{"SpringElectricalEmbedding", "EnergyControl"->#,"StepControl"->"Monotonic"}}]&/@{Automatic,"Monotonic","NonMonotonic"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","InferentialDistance"->#}]&/@{Automatic, .1, .5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","MaxIteration"->#}]&/@{Automatic, 1, 2}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","Multilevel"->#}]&/@{Automatic, None, "MaximalIndependentVertexSet","MaximalIndependentVertexSetRugeStuben","MaximalIndependentVertexSetInjection","MaximalIndependentVertexSetRugeStubenInjection","MaximalIndependentEdgeSetHeavyEdge","MaximalIndependentEdgeSet","MaximalIndependentEdgeSetSmallestVertexWeight","Hybrid"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","Octree"->#}]&/@{True,False}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","RandomSeed"->#}]&/@{1,5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","RepulsiveForcePower"->#}]&/@{-1,-2.5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","StepControl"->#}]&/@{Automatic,"Monotonic","NonMonotonic","StrictlyMonotonic"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","StepLength"->#}]&/@{1,4.5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,20];

GraphPlot3D[edge,GraphLayout->{"SpringElectricalEmbedding","Tolerance"->#}]&/@{Automatic,.5}

OpenersExampleSubsubsection17(Spacer1)"SpringEmbedding"  (10)

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

GraphPlot3D[{1\[UndirectedEdge]14,1\[UndirectedEdge]15,1\[UndirectedEdge]16,2\[UndirectedEdge]5,2\[UndirectedEdge]6,2\[UndirectedEdge]13,3\[UndirectedEdge]7,3\[UndirectedEdge]14,3\[UndirectedEdge]19,4\[UndirectedEdge]8,4\[UndirectedEdge]15,4\[UndirectedEdge]20,5\[UndirectedEdge]11,5\[UndirectedEdge]19,6\[UndirectedEdge]12,6\[UndirectedEdge]20,7\[UndirectedEdge]11,7\[UndirectedEdge]16,8\[UndirectedEdge]12,8\[UndirectedEdge]16,9\[UndirectedEdge]10,9\[UndirectedEdge]14,9\[UndirectedEdge]17,10\[UndirectedEdge]15,10\[UndirectedEdge]18,11\[UndirectedEdge]12,13\[UndirectedEdge]17,13\[UndirectedEdge]18,17\[UndirectedEdge]19,18\[UndirectedEdge]20},GraphLayout->"SpringEmbedding"]

With the setting "EdgeWeighted"->(RefLink[True, paclet:ref/True]), edge weights are used:

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,10];
weight=RandomInteger[{1,5},11];

GraphPlot3D[edge,EdgeWeight->weight,GraphLayout->{"SpringEmbedding", "EdgeWeighted"->#}]&/@{True, False}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,{GraphLayout->{"SpringEmbedding", "EnergyControl"->#}}]&/@{Automatic,"Monotonic","NonMonotonic"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","InferentialDistance"->#}]&/@{Automatic, .5,2}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","MaxIteration"->#}]&/@{Automatic, 1, 2}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","Multilevel"->#}]&/@{Automatic, None, "MaximalIndependentVertexSet","MaximalIndependentVertexSetRugeStuben","MaximalIndependentVertexSetInjection","MaximalIndependentVertexSetRugeStubenInjection","MaximalIndependentEdgeSetHeavyEdge","MaximalIndependentEdgeSet","MaximalIndependentEdgeSetSmallestVertexWeight","Hybrid"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","RandomSeed"->#}]&/@{1,5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","StepControl"->#}]&/@{Automatic,"Monotonic","NonMonotonic","StrictlyMonotonic"}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","StepLength"->#}]&/@{1,4.5}

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

edge=RandomInteger[#]\[UndirectedEdge]#+1&/@Range[0,30];

GraphPlot3D[edge,GraphLayout->{"SpringEmbedding","Tolerance"->#}]&/@{Automatic,.5}

OpenersExampleSubsubsection18(Spacer1)"StarEmbedding"  (3)

Place vertices on a star shape:

GraphPlot3D[Table[1\[UndirectedEdge]i,{i,2,6}],GraphLayout->"StarEmbedding"]

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

GraphPlot3D[StarGraph[15],GraphLayout->{"StarEmbedding", "Offset"->#}]&/@{Automatic,{30 Degree, 30 Degree},{50 Degree, 80 Degree}}

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

GraphPlot3D[StarGraph[15],GraphLayout->{"StarEmbedding", "Center"->#}]&/@{Automatic,10}

OpenersExampleSubsubsection19(Spacer1)"TutteEmbedding"  (2)

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

GraphPlot3D[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},GraphLayout->"TutteEmbedding"]

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

GraphPlot3D[GraphData[{"JohnsonSkeleton",77},"EdgeList"],GraphLayout->"TutteEmbedding"]

OpenersExampleSubsection5(Spacer1)PlotStyle  (3)

Specify an overall style for the graph:

Table[GraphPlot3D[{1->2,2->3,3->4,1->4,1->3},PlotStyle->ps],{ps,{Red,Blue}}]

(RefLink[PlotStyle, paclet:ref/PlotStyle]) can be combined with (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]), which has higher priority:

GraphPlot3D[{1->2,2->3,3->4,1->4,1->3},PlotStyle->Directive[PointSize[Large],Red],VertexShapeFunction->Function[{p},{Green,Point[p]}]]

(RefLink[PlotStyle, paclet:ref/PlotStyle]) can be combined with (RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]), which has higher priority:

GraphPlot3D[{1->2,2->3,3->4,1->4,1->3},PlotStyle->Directive[Dashed,Red],EdgeShapeFunction->Function[{p},{Green,Line[p]}]]

OpenersExampleSection3(Spacer1)Applications  (2)

Make a 3D graph layout with spheres and cylinders:

GraphPlot3D[SimpleGraph[Table[i\[UndirectedEdge]Mod[i^2,75],{i,75}]],EdgeShapeFunction->({Cylinder[#1,0.1]}&),VertexShapeFunction->({Sphere[#,0.3]}&)]

Structure an engineering matrix:

GraphPlot3D[ExampleData[{"Matrix","HB/dwt_1005"},"Matrix"],VertexShapeFunction->None]

OpenersExampleSection4(Spacer1)Properties & Relations  (7)

Use (RefLink[LayeredGraphPlot, paclet:ref/LayeredGraphPlot]) for hierarchical-style drawing of directed graphs:

LayeredGraphPlot[{{"main"->"fun1","fun1[a,b]"},{"main"->"fun2","fun2[1,2,3]"},{"fun2"->"fun3","fun3[0.5]"},{"main"->"fun3","fun3[0.6]"}}, PlotTheme->"DiagramBlue"]

Use (RefLink[TreePlot, paclet:ref/TreePlot]) for different types of tree drawing:

TreePlot[Flatten[Table[{i-> 2i+j-1},{j,2},{i,7}]]]

Use (RefLink[GraphPlot, paclet:ref/GraphPlot]) to draw graphs in 2D:

GraphPlot[Table[i->Mod[i^2,200],{i,200}]]

Use (RefLink[GraphData, paclet:ref/GraphData]) for an extensive collection of predefined graphs and properties:

Short[GraphData[],3]

Get the connectivity and plot it:

GraphData["DesarguesGraph","EdgeRules"]

GraphPlot3D[%]

Use (RefLink[PolyhedronData, paclet:ref/PolyhedronData]) for a large collection of polyhedra and properties:

PolyhedronData["Dodecahedron","Skeleton","Rule"]

GraphPlot3D[%]

Compare to a predefined embedding:

PolyhedronData["Dodecahedron","Skeleton"]

Use (RefLink[ExampleData, paclet:ref/ExampleData]) for a large collection of sparse matrices:

GraphPlot3D[ExampleData[{"Matrix","HB/can_229"},"Matrix"]]

Use (RefLink[ArrayPlot, paclet:ref/ArrayPlot]) or (RefLink[MatrixPlot, paclet:ref/MatrixPlot]) to display sparse matrices:

g=ExampleData[{"Matrix","Bai/bfwa62"},"Matrix"]

{ArrayPlot[g],MatrixPlot[g]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Graph3D, paclet:ref/Graph3D])  ▪  (RefLink[Graph, paclet:ref/Graph])  ▪  (RefLink[GraphPlot, paclet:ref/GraphPlot])  ▪  (RefLink[LayeredGraphPlot, paclet:ref/LayeredGraphPlot])  ▪  (RefLink[TreePlot, paclet:ref/TreePlot])  ▪  (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Computational Geometry, paclet:guide/ComputationalGeometry])}, {▪(RefLinkPlain[Graph Visualization, paclet:guide/GraphVisualization])}})}})