WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

PlanarGraph [{e1,e2,}]

yields a planar graph with edges ej.

PlanarGraph [{v1,v2,},{e1,e2,}]

yields a planar graph with vertices vi and edges ej.

PlanarGraph [{,wi[vi],},{,wj[ej],}]

yields a planar graph with vertex and edge properties defined by the symbolic wrappers wk.

PlanarGraph [{vivj,}]

uses rules vivj to specify a planar graph.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Connectivity  
Wrappers  
Styling  
Labeling  
Options  
AnnotationRules  
DirectedEdges  
EdgeLabels  
Show More Show More
EdgeShapeFunction  
EdgeStyle  
EdgeWeight  
GraphHighlight  
GraphHighlightStyle  
GraphLayout  
PlotTheme  
Base Themes  
Feature Themes  
VertexCoordinates  
VertexLabels  
VertexShape  
VertexShapeFunction  
VertexSize  
VertexStyle  
VertexWeight  
See Also
Related Guides
History
Cite this Page

PlanarGraph [{e1,e2,}]

yields a planar graph with edges ej.

PlanarGraph [{v1,v2,},{e1,e2,}]

yields a planar graph with vertices vi and edges ej.

PlanarGraph [{,wi[vi],},{,wj[ej],}]

yields a planar graph with vertex and edge properties defined by the symbolic wrappers wk.

PlanarGraph [{vivj,}]

uses rules vivj to specify a planar graph.

Details and Options

  • PlanarGraph generates a Graph object.
  • A graph is planar if it can be drawn in the plane without edge crossings.
  • PlanarGraph displays the graph using a planar embedding if possible.
  • PlanarGraph supports the same vertices, edges, and wrappers as Graph .
  • PlanarGraph takes the same options as Graph , with GraphLayout methods restricted to "PlanarEmbedding" and "TutteEmbedding".

Examples

open all close all

Basic Examples  (2)

A planar graph:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}]

The three-dimensional HypercubeGraph is planar:

Wolfram Language code: g = HypercubeGraph[3]
Wolfram Language code: PlanarGraphQ[g]

A planar drawing:

Wolfram Language code: PlanarGraph[EdgeList[g]]

Scope  (25)

Connectivity  (6)

Create an undirected planar graph using characters; enter the character as ue:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}]

Create a directed planar graph using characters; enter the character as de:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}]

Create a directed planar graph from a list of rules:

Wolfram Language code: PlanarGraph[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3, 2 -> 4, 3 -> 4}]

Create an undirected planar graph from a list of rules:

Wolfram Language code: PlanarGraph[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3, 2 -> 4, 3 -> 4}, DirectedEdges -> False]

Use VertexList and EdgeList to get vertices and edges:

Wolfram Language code: {g1, g2} = {PlanarGraph[{12, 13, 14, 23, 24, 34}], PlanarGraph[{34, 12, 13, 14, 23, 24}]}

The ordering for edges is the order in which they were entered:

Wolfram Language code: EdgeList /@ {g1, g2}

The ordering for vertices is the order in which they were entered in the edges:

Wolfram Language code: VertexList /@ {g1, g2}

Use an explicit vertex list to control the ordering used by VertexList :

Wolfram Language code: {g1, g2} = {PlanarGraph[{1, 2, 3, 4}, {12, 13, 14, 23, 24, 34}], PlanarGraph[{3, 2, 1, 4}, {12, 13, 14, 23, 24, 34}]}

The input vertex list controls the resulting vertex order:

Wolfram Language code: VertexList /@ {g1, g2}

Any expression can be used as vertices:

Wolfram Language code: {PlanarGraph[{ab, ac, bc}], PlanarGraph[{"foo""bar", "foo""gnu", "bar""gnu"}], PlanarGraph[{[image][image], [image][image], [image][image]}]}
Wolfram Language code: VertexList /@ %

Wrappers  (5)

Use wrappers on vertices or edges:

Wolfram Language code: {PlanarGraph[{Style[1, Red], 2, 3, 4}, {12, 13, 14, 23, 24, 34}], PlanarGraph[{1, 2, 3, 4}, {Style[12, Red], 13, 14, 23, 24, 34}]}

Wrappers can be nested:

Wolfram Language code: {PlanarGraph[{Labeled[Style[1, Red], "hello"], 2, 3, 4}, {12, 13, 14, 23, 24, 34}], PlanarGraph[{1, 2, 3, 4}, {Style[Labeled[12, "hello"], Red], 13, 14, 23, 24, 34}]}

Add interactive behavior by wrappers such as Tooltip :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, Tooltip[Style[34, Red], "hello"]}]

Any object can be used in the tooltip:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, Tooltip[Style[34, Red], Plot[Sin[x], {x, 0, 2Pi}]]}]

Use Button to trigger actions when clicking an edge or vertex:

Wolfram Language code: {PlanarGraph[{12, 13, 14, Button[Style[23, Red], Speak["Edge from 1 to 3"]], 24, 34}], PlanarGraph[{1, 2, Button[Style[3, Red], Speak["Vertex 3"]]}, {12, 13, 14, 23, 24, 34}, VertexSize -> Medium]}

Use PopupWindow to provide information drilldown:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, PopupWindow[Style[34, Red], DateListPlot[FinancialData["IBM", "Jan. 1, 2004"]]]}]

Styling  (8)

Set the style for all vertices or edges:

Wolfram Language code: {PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> Green], PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> Green]}

Style individual vertices or edges using options:

Wolfram Language code: {PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> {1 -> Green, Orange}], PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> {12 -> Green, Orange}]}

Use wrappers for individual styling:

Wolfram Language code: {PlanarGraph[{Style[1, Green], 2, 3}, {12, 13, 14, 23, 24, 34}, VertexStyle -> Orange], PlanarGraph[{Style[12, Green], 13, 14, 23, 24, 34}, EdgeStyle -> Orange]}

Adjust the size of vertices using symbolic sizes:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Or use sizes in terms of the smallest distance between vertex centers:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, PlotLabel -> s], {s, {0.1, 0.2, 0.5, 1}}]

Use built-in collections for VertexShapeFunction :

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> s], {s, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]

Rounded shapes:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> Style[s, 9]], {s, ResourceData["VertexShapeFunction", "Rounded"]}]

Concave shapes:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> Style[s, 9]], {s, ResourceData["VertexShapeFunction", "Concave"]}]

Draw individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]

Combine with a default vertex function:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]

Use any Graphics , Image , or Graphics3D as a vertex shape:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShape -> s, VertexSize -> Medium], {s, {[image], [image], [image]}}]

Use built-in collections for EdgeShapeFunction :

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]

Directed edges including solid arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> Style[ef, 9]], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

Line arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> Style[ef, 9]], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]

Open arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> Style[ef, 9]], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]

Specify an edge function for an individual edge:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {12 -> "UnfilledArrow"}]

Combine with a different default edge function:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {12 -> "FilledArrow", "CarvedArrow"}]

Labeling  (6)

Label any edge or vertex:

Wolfram Language code: {PlanarGraph[{Labeled[12, "hello"], 13, 14, 23, 24, 34}], PlanarGraph[{Labeled[1, "hello"], 2, 3, 4}, {12, 13, 14, 23, 24, 34}]}

Use any expression as a label:

Wolfram Language code: Table[PlanarGraph[{1, 2, Labeled[3, l], 4}, {12, 13, 14, 23, 24, 34}], {l, {Sin[x], [image], [image]}}]
Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, Labeled[34, l]}], {l, {Sin[x], [image], [image]}}]

Control the placement of vertex labels using Placed , including symbolic inside positions:

Wolfram Language code: Table[PlanarGraph[{1, 2, Labeled[3, Placed["■■", p]]}, {12, 13, 14, 23, 24, 34}, PlotLabel -> p, VertexSize -> 0.25, VertexShapeFunction -> "Square"], {p, {Left, Right, Top, Bottom}}]

Symbolic outside positions:

Wolfram Language code: Table[PlanarGraph[{1, 2, Labeled[3, Placed["■■", p]]}, {12, 13, 14, 23, 24, 34}, PlotLabel -> p, VertexSize -> Small, VertexShapeFunction -> "Square"], {p, {Before, After, Below, Above}}]

Coordinate-based positions:

Wolfram Language code: Table[PlanarGraph[{1, 2, Labeled[3, Placed["■", p]]}, {12, 13, 14, 23, 24, 34}, VertexSize -> 0.25, VertexShapeFunction -> "Square", PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place multiple labels using Placed in a wrapper:

Wolfram Language code: PlanarGraph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {12, 13, 14, 23, 24, 34}]

Any number of labels can be used:

Wolfram Language code: PlanarGraph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]]}, {12, 13, 14, 23, 24, 34}]

Place multiple labels using VertexLabels :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> {3 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]

Use Placed with symbolic locations to control label placement along an edge:

Wolfram Language code: Table[PlanarGraph[{Labeled[12, Placed["■■", p]], 13, 14, 23, 24, 34}, PlotLabel -> p, VertexSize -> Small], {p, {"Start", "Middle", "End"}}]

Use explicit coordinates to place labels:

Wolfram Language code: Table[PlanarGraph[{Labeled[12, Placed["■■", p]], 13, 14, 23, 24, 34}, PlotLabel -> p, VertexSize -> Small, BaselinePosition -> Bottom], {p, {0, 1 / 4, 1 / 3}}]

Place multiple labels using Placed in a wrapper:

Wolfram Language code: PlanarGraph[{12, Labeled[31, Placed[{"lbl1", "lbl2"}, {"Start", "End"}]], 14, 23, 24, 34}]

Any number of labels can be used:

Wolfram Language code: PlanarGraph[{12, Labeled[31, Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]], 14, 23, 24, 34}]

Place multiple labels using EdgeLabels :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {31 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]

Options  (80)

AnnotationRules  (3)

Specify an annotation for vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, AnnotationRules -> {1 -> {VertexLabels -> "hello"}}]

Edges:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, AnnotationRules -> {12 -> {EdgeLabels -> "hello"}}]

Graph itself:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, AnnotationRules -> {"GraphProperties" -> {"Message" -> "hello"}}]
Wolfram Language code: AnnotationValue[%, "Message"]

DirectedEdges  (2)

By default, a directed planar graph is generated when giving a list of rules:

Wolfram Language code: PlanarGraph[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3, 2 -> 4, 3 -> 4}]

Use DirectedEdges ->False to interpret rules as undirected edges:

Wolfram Language code: PlanarGraph[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3, 2 -> 4, 3 -> 4}, DirectedEdges -> False]

Use DirectedEdge or UndirectedEdge to directly specify whether a graph is directed or not:

Wolfram Language code: {PlanarGraph[{12, 13, 14, 23, 24, 34}], PlanarGraph[{12, 13, 14, 23, 24, 34}]}

EdgeLabels  (7)

Label the edge 12:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> "Hello"}]

Label all edges:

Wolfram Language code: el = {12, 13, 14, 23, 24, 34};
Wolfram Language code: PlanarGraph[el, EdgeLabels -> Table[el[[i]] -> Subscript["e", i], {i, Length[el]}]]

Use any expression as a label:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> [image], 14 -> [image], 24 -> [image]}]

Use Placed with symbolic locations to control label placement along an edge:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> Placed["■■■", p]}, PlotLabel -> p], {p, {"Start", "Middle", "End"}}]

Use explicit coordinates to place labels:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> Placed["■■■", p]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {0, 1 / 3, 1 / 4}}]

Vary positions within the label:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> Placed["■■■", {1 / 2, p}]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place multiple labels using Placed in a wrapper:

Wolfram Language code: PlanarGraph[{12, Labeled[31, Placed[{"lbl1", "lbl2"}, {"Start", "End"}]], 14, 23, 24, 34}]

Any number of labels can be used:

Wolfram Language code: PlanarGraph[{12, Labeled[31, Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]], 14, 23, 24, 34}]

Place multiple labels using EdgeLabels :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> {12 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]

Use automatic labeling by values through Tooltip and StatusArea :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> Placed["Name", Tooltip]]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeLabels -> Placed["Name", StatusArea]]

EdgeShapeFunction  (6)

Get a list of built-in settings for EdgeShapeFunction :

Wolfram Language code: ResourceData["EdgeShapeFunction"]

Undirected edges including the basic line:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> "Line"]

Lines with different glyphs on the edges:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]

Directed edges including solid arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

Line arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]

Open arrows:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]

Specify an edge function for an individual edge:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {12 -> "FilledArcArrow"}]

Combine with a different default edge function:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> {12 -> "FilledArcArrow", "CarvedArrow"}]

Draw edges by running a program:

Wolfram Language code: ef[pts_List, e_] := Block[{s = 0.015, g = [image]}, {Arrowheads[{{s, 0.33, g}, {s, 0.67, g}}], Arrow[pts]}]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeShapeFunction -> ef]

EdgeShapeFunction can be combined with EdgeStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> Blue, EdgeShapeFunction -> (Line[#1]&)]

EdgeShapeFunction has higher priority than EdgeStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> Blue, EdgeShapeFunction -> ({Red, Line[#1]}&)]

EdgeStyle  (2)

Style all edges:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> style, PlotLabel -> style], {style, {Gray, Dashed, Thick}}]

Style individual edges:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeStyle -> {12 -> Blue, 13 -> Dashed}]

EdgeWeight  (2)

Specify the weight for all edges:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeWeight -> RandomInteger[5, 6]]
Wolfram Language code: WeightedAdjacencyMatrix[%]//MatrixForm

Use any numeric expression as a weight:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, EdgeWeight -> {a, b, c, d, e, f}]
Wolfram Language code: WeightedAdjacencyMatrix[%]//MatrixForm

GraphHighlight  (3)

Highlight the vertex 1:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> Medium, GraphHighlight -> {1}]

Highlight the edge 12:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> Tiny, GraphHighlight -> {12}]

Highlight vertices and edges:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> Tiny, GraphHighlight -> {1, 2, 12, 23}]

GraphHighlightStyle  (2)

Get a list of built-in settings for GraphHighlightStyle :

Wolfram Language code: ResourceData["GraphHighlightStyle"]

Use built-in settings for GraphHighlightStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, GraphHighlight -> {1, 23}, VertexSize -> Small, GraphHighlightStyle -> #, PlotLabel -> #]& /@ Select[ResourceData["GraphHighlightStyle"], # =!= Automatic&]

GraphLayout  (2)

By default, the layout is chosen automatically:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, GraphLayout -> Automatic]

Specify layouts on planar graphs:

Wolfram Language code: Table[PlanarGraph[{12, 15, 16, 23, 27, 34, 38, 45, 49, 510, 67, 610, 78, 89, 910}, GraphLayout -> l, PlotLabel -> l], {l, {"TutteEmbedding", "PlanarEmbedding"}}]

PlotTheme  (4)

Base Themes  (2)

Use a common base theme:

Wolfram Language code: PlanarGraph[{12, 23, 31}, PlotTheme -> "Business"]

Use a monochrome theme:

Wolfram Language code: PlanarGraph[{12, 23, 31}, PlotTheme -> "Monochrome"]

Feature Themes  (2)

Use a large graph theme:

Wolfram Language code: PlanarGraph[{12, 23, 31}, PlotTheme -> "LargeGraph"]

Use a classic diagram theme:

Wolfram Language code: PlanarGraph[{12, 23, 31}, PlotTheme -> "ClassicDiagram"]

VertexCoordinates  (3)

By default, any vertex coordinates are computed automatically:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}]

Extract the resulting vertex coordinates using AbsoluteOptions :

Wolfram Language code: AbsoluteOptions[%, VertexCoordinates]

Specify a layout function along an ellipse:

Wolfram Language code: ellipseLayout[n_, {a_, b_}] := Table[{a Cos[2Pi / n u], b Sin[2Pi / n u]}, {u, 1, n}]
Wolfram Language code: Graphics[Point[ellipseLayout[20, {2, 1}]]]

Use it to generate vertex coordinates for a graph:

Wolfram Language code: PlanarGraph[Table[1i, {i, 2, 20}], VertexCoordinates -> ellipseLayout[20, {2, 1}]]

VertexCoordinates has higher priority than GraphLayout :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexCoordinates -> Table[{i, i}, {i, 4}], GraphLayout -> "TutteEmbedding"]

VertexLabels  (13)

Use vertex names as labels:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> "Name"]

Label individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> {2 -> "one"}]

Label all vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Table[i -> Subscript[v, i], {i, 4}]]

Use any expression as a label:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> {1 -> [image], 2 -> [image], 4 -> [image]}]

Use Placed with symbolic locations to control label placement, including outside positions:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Placed["■■■", p], PlotLabel -> p], {p, {Before, After, Below, Above}}]

Symbolic outside corner positions:

Wolfram Language code: pl = {{Before, Below}, {After, Below}, {Before, Above}, {After, Above}};
Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Placed["■■■", p], PlotLabel -> p], {p, pl}]

Symbolic inside positions:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.35, VertexLabels -> Placed["■■", p], VertexShapeFunction -> "Square", PlotLabel -> p], {p, {Left, Top, Right, Bottom}}]

Symbolic inside corner positions:

Wolfram Language code: pl = {{Left, Bottom}, {Right, Bottom}, {Left, Top}, {Right, Top}};
Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> .6, VertexShapeFunction -> "Square", VertexLabels -> Placed["■■", p], PlotLabel -> p], {p, pl}]

Use explicit coordinates to place the center of labels:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.5, VertexShapeFunction -> "Square", VertexLabels -> Placed[[image], p], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place all labels at the upper-right corner of the vertex and vary the coordinates within the label:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Placed[[image], {{1, 1}, p}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place multiple labels using Placed in a wrapper:

Wolfram Language code: PlanarGraph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {12, 13, 14, 23, 24, 34}]

Any number of labels can be used:

Wolfram Language code: PlanarGraph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]]}, {12, 13, 14, 23, 24, 34}]

Place multiple labels using VertexLabels :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> {3 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]

Use the argument to Placed to control formatting including Tooltip :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Placed["Name", Tooltip]]

Or StatusArea :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Placed["Name", StatusArea]]

Use more elaborate formatting functions:

Wolfram Language code: rotateLabel[lab_] := Rotate[lab, 45Degree]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Placed["xxx", Below, rotateLabel]]
Wolfram Language code: panelLabel[lab_] := Panel[lab, FrameMargins -> 0, Background -> Lighter[Yellow, 0.7]]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Placed["xxx", Center, panelLabel]]
Wolfram Language code: hyperlinkLabel[lab_] := Hyperlink[lab, "http://www.wolfram.com"]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexLabels -> Placed["xxx", Center, hyperlinkLabel]]

VertexShape  (5)

Use any Graphics , Image , or Graphics3D as a vertex shape:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShape -> s, VertexSize -> 0.3], {s, {[image], [image], [image]}}]

Specify vertex shapes for individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShape -> {2 -> [image]}, VertexSize -> 0.3]

VertexShape can be combined with VertexSize :

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {Medium, Large}}]

VertexShape is not affected by VertexStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.3, VertexShape -> [image], VertexStyle -> Blue]

VertexShapeFunction has higher priority than VertexShape :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexShape -> [image]]

VertexShapeFunction  (10)

Get a list of built-in collections for VertexShapeFunction :

Wolfram Language code: ResourceData["VertexShapeFunction"]

Use built-in settings for VertexShapeFunction in the "Basic" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Basic"]

Simple basic shapes:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]

Common basic shapes:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"DownTrapezoid", "UpTrapezoid", "Parallelogram", "FiveDown", "Circle", "Diamond", "Star", "Capsule"}}]

Use built-in settings for VertexShapeFunction in the "Rounded" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Rounded"]
Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Rounded"]}]

Use built-in settings for VertexShapeFunction in the "Concave" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Concave"]
Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Concave"]}]

Draw individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]

Combine with a default vertex function:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]

Draw vertices using a predefined graphic:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> (Inset[[image], #]&)]

Draw vertices by running a program:

Wolfram Language code: vf[{xc_, yc_}, name_, {w_, h_}] := Block[{xmin = xc - w, xmax = xc + w, ymin = yc - h, ymax = yc + h}, Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}] ];
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> vf, VertexSize -> 0.2]

VertexShapeFunction can be combined with VertexStyle :

Wolfram Language code: vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

VertexShapeFunction has higher priority than VertexStyle :

Wolfram Language code: vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

VertexShapeFunction can be combined with VertexSize :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexShapeFunction -> "Star", VertexSize -> {1 -> Small, Medium}]

VertexShapeFunction has higher priority than VertexShape :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.3, VertexShapeFunction -> "Star", VertexShape -> [image]]

VertexSize  (8)

By default, the size of vertices is computed automatically:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> Automatic]

Specify the size of all vertices using symbolic vertex size:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Use a fraction of the minimum distance between vertex coordinates:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, PlotLabel -> s], {s, 0.1, 1, 0.3}]

Use a fraction of the overall diagonal for all vertex coordinates:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> {"Scaled", s}, PlotLabel -> {"Scaled", s}], {s, 0.1, 1, 0.3}]

Specify size in both the and directions:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, PlotLabel -> s], {s, {{0.1, 0.2}, {0.2, 0.1}}}]

Specify the size for individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> {1 -> 0.2, 2 -> 0.3}]

VertexSize can be combined with VertexShapeFunction :

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, VertexShapeFunction -> "Square", PlotLabel -> s], {s, {0.05, 0.1, 0.2}}]

VertexSize can be combined with VertexShape :

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {0.1, 0.2, 0.4}}]

VertexStyle  (5)

Style all vertices:

Wolfram Language code: Table[PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> style, VertexSize -> 0.3, PlotLabel -> style], {style, {Yellow, EdgeForm[Dashed]}}]

Style individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> {1 -> Blue, 2 -> Red}, VertexSize -> 0.2]

VertexShapeFunction can be combined with VertexStyle :

Wolfram Language code: vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

VertexShapeFunction has higher priority than VertexStyle :

Wolfram Language code: vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}
Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

VertexStyle can be combined with BaseStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> LightBlue, BaseStyle -> EdgeForm[Dotted], VertexSize -> 0.2]

VertexStyle has higher priority than BaseStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexStyle -> LightBlue, BaseStyle -> Gray, VertexSize -> 0.2]

VertexShape is not affected by VertexStyle :

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexSize -> 0.3, VertexShape -> [image], VertexStyle -> Blue]

VertexWeight  (3)

Set the weight for all vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexWeight -> {2, 3, 4, 5}]
Wolfram Language code: AnnotationValue[{%, 1}, VertexWeight]

Specify the weight for individual vertices:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexWeight -> {1 -> 2}]

Use any numeric expression as a weight:

Wolfram Language code: PlanarGraph[{12, 13, 14, 23, 24, 34}, VertexWeight -> {a, b, c, d}]
Wolfram Language code: AnnotationValue[{%, 1}, VertexWeight]
Wolfram Research (2016), PlanarGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/PlanarGraph.html.

Text

Wolfram Research (2016), PlanarGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/PlanarGraph.html.

CMS

Wolfram Language. 2016. "PlanarGraph." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PlanarGraph.html.

APA

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

BibTeX

@misc{reference.wolfram_2026_planargraph, author="Wolfram Research", title="{PlanarGraph}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/PlanarGraph.html}", note=[Accessed: 13-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_planargraph, organization={Wolfram Research}, title={PlanarGraph}, year={2016}, url={https://reference.wolfram.com/language/ref/PlanarGraph.html}, note=[Accessed: 13-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /