({{, (RefLink[PlanarGraph, paclet:ref/PlanarGraph])[{(Subscript[e, 1]),(Subscript[e, 2]),…}] 
yields a planar graph with edges (Subscript[e, j]).}, {, (RefLink[PlanarGraph, paclet:ref/PlanarGraph])[{(Subscript[v, 1]),(Subscript[v, 2]),…},{(Subscript[e, 1]),(Subscript[e, 2]),…}]
yields a planar graph with vertices (Subscript[v, i]) and edges (Subscript[e, j]).}, {, (RefLink[PlanarGraph, paclet:ref/PlanarGraph])[{…,(Subscript[w, i])[(Subscript[v, i])],…},{…,(Subscript[w, j])[(Subscript[e, j])],…}]
yields a planar graph with vertex and edge properties defined by the symbolic wrappers (Subscript[w, k]).}, {, (RefLink[PlanarGraph, paclet:ref/PlanarGraph])[{(Subscript[v, i])->(Subscript[v, j]),…}]
uses rules (Subscript[v, i])->(Subscript[v, j]) to specify a planar graph.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[PlanarGraph, paclet:ref/PlanarGraph]) generates a (RefLink[Graph, paclet:ref/Graph]) object.

A graph is planar if it can be drawn in the plane without edge crossings.

(RefLink[PlanarGraph, paclet:ref/PlanarGraph]) displays the graph using a planar embedding if possible.

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

(RefLink[PlanarGraph, paclet:ref/PlanarGraph]) takes the same options as (RefLink[Graph, paclet:ref/Graph]), with (RefLink[GraphLayout, paclet:ref/GraphLayout]) methods restricted to "PlanarEmbedding" and "TutteEmbedding".

OpenersPrimaryExamplesSection(Spacer1)Examples  (107)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

A planar graph:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

The three-dimensional (RefLink[HypercubeGraph, paclet:ref/HypercubeGraph]) is planar:

g=HypercubeGraph[3]

PlanarGraphQ[g]

A planar drawing:

PlanarGraph[EdgeList[g]]

OpenersExampleSection1(Spacer1)Scope  (25)

OpenersExampleSubsection0(Spacer1)Connectivity  (6)

Create an undirected planar graph using <-> characters; enter the character as (Key0[esc]) ue (Key0[esc]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Create a directed planar graph using -> characters; enter the character as (Key0[esc]) de (Key0[esc]):

PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4}]

Create a directed planar graph from a list of rules:

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

Create an undirected planar graph from a list of rules:

PlanarGraph[{1->2,1->3,1->4,2->3,2->4,3->4}, DirectedEdges->False]

Use (RefLink[VertexList, paclet:ref/VertexList]) and (RefLink[EdgeList, paclet:ref/EdgeList]) to get vertices and edges:

{g1,g2}={PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{3\[UndirectedEdge]4,1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4}]}

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

EdgeList/@{g1,g2}

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

VertexList/@{g1,g2}

Use an explicit vertex list to control the ordering used by (RefLink[VertexList, paclet:ref/VertexList]):

{g1,g2}={PlanarGraph[{1,2,3,4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{3,2,1,4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]}

The input vertex list controls the resulting vertex order:

VertexList/@{g1,g2}

Any expression can be used as vertices:

{PlanarGraph[{a\[UndirectedEdge]b,a\[UndirectedEdge]c, b\[UndirectedEdge]c}],PlanarGraph[{"foo"\[UndirectedEdge]"bar","foo"\[UndirectedEdge]"gnu","bar"\[UndirectedEdge]"gnu"}],
PlanarGraph[{\[UndirectedEdge],\[UndirectedEdge],\[UndirectedEdge]}]}

VertexList/@%

OpenersExampleSubsection1(Spacer1)Wrappers  (5)

Use wrappers on vertices or edges:

{PlanarGraph[{Style[1,Red],2,3,4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{1,2,3,4},{Style[1\[UndirectedEdge]2,Red],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]}

Wrappers can be nested:

{PlanarGraph[{Labeled[Style[1,Red],"hello"],2,3,4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{1,2,3,4},{Style[Labeled[1\[UndirectedEdge]2,"hello"],Red],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]}

Add interactive behavior by wrappers such as (RefLink[Tooltip, paclet:ref/Tooltip]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,Tooltip[Style[3\[UndirectedEdge]4,Red],"hello"]}]

Any object can be used in the tooltip:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,Tooltip[Style[3\[UndirectedEdge]4,Red],Plot[Sin[x],{x,0,2Pi}]]}]

Use (RefLink[Button, paclet:ref/Button]) to trigger actions when clicking an edge or vertex:

{PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,Button[Style[2\[UndirectedEdge]3,Red],Speak["Edge from 1 to 3"]],2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{1,2,Button[Style[3,Red],Speak["Vertex 3"]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->Medium]}

Use (RefLink[PopupWindow, paclet:ref/PopupWindow]) to provide information drilldown:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,PopupWindow[Style[3\[UndirectedEdge]4,Red],DateListPlot[FinancialData["IBM","Jan. 1, 2004"]]]}]

OpenersExampleSubsection2(Spacer1)Styling  (8)

Set the style for all vertices or edges:

{PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->Green],PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->Green]}

Style individual vertices or edges using options:

{PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->{1->Green,Orange}],PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->{1\[UndirectedEdge]2->Green,Orange}]}

Use wrappers for individual styling:

{PlanarGraph[{Style[1,Green],2,3},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->Orange],PlanarGraph[{Style[1\[UndirectedEdge]2,Green],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->Orange]}

Adjust the size of vertices using symbolic sizes:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,PlotLabel->s],{s,{Tiny,Small,Medium,Large}}]

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

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,PlotLabel->s],{s,{0.1,0.2,0.5,1}}]

Use built-in collections for (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]):

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->s,VertexSize->0.2,PlotLabel->s],{s,{"Triangle","Square","Rectangle","Pentagon","Hexagon","Octagon"}}]

Rounded shapes:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->s,VertexSize->0.2,PlotLabel->Style[s,9]],{s,GraphElementData["Vertex","Rounded"]}]

Concave shapes:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->s,VertexSize->0.2,PlotLabel->Style[s,9]],{s,GraphElementData["Vertex","Concave"]}]

Draw individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->{ 1->"Square"},VertexSize->0.2]

Combine with a default vertex function:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->{ 1->"Square","Triangle"},VertexSize->0.2]

Use any (RefLink[Graphics, paclet:ref/Graphics]), (RefLink[Image, paclet:ref/Image]), or (RefLink[Graphics3D, paclet:ref/Graphics3D]) as a vertex shape:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShape->s,VertexSize->Medium],{s,{,,}}]

Use built-in collections for (RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]):

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->ef],{ef,{"BoxLine","DiamondLine","DotLine"}}]

Directed edges including solid arrows:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->Style[ef,9]],{ef,GraphElementData["Edge","FilledArrow"]}]

Line arrows:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->Style[ef,9]],{ef,GraphElementData["Edge","UnfilledArrow"]}]

Open arrows:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->Style[ef,9]],{ef,GraphElementData["Edge","CarvedArrow"]}]

Specify an edge function for an individual edge:

PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->{1\[DirectedEdge]2->"UnfilledArrow"}]

Combine with a different default edge function:

PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->{1\[DirectedEdge]2->"FilledArrow","CarvedArrow"}]

OpenersExampleSubsection3(Spacer1)Labeling  (6)

Label any edge or vertex:

{PlanarGraph[{Labeled[1\[UndirectedEdge]2,"hello"],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],PlanarGraph[{Labeled[1,"hello"],2,3,4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]}

Use any expression as a label:

Table[PlanarGraph[{1,2,Labeled[3,l],4},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}],{l,{Sin[x],,}}]

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,Labeled[3\[UndirectedEdge]4,l]}],{l,{Sin[x],,}}]

Control the placement of vertex labels using (RefLink[Placed, paclet:ref/Placed]), including symbolic inside positions:

Table[PlanarGraph[{1,2,Labeled[3,Placed["■■",p]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},PlotLabel->p,VertexSize->0.25,VertexShapeFunction->"Square"],{p,{Left,Right,Top,Bottom}}]

Symbolic outside positions:

Table[PlanarGraph[{1,2,Labeled[3,Placed["■■",p]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},PlotLabel->p,VertexSize->Small,VertexShapeFunction->"Square"],{p,{Before,After,Below,Above}}]

Coordinate-based positions:

Table[PlanarGraph[{1,2,Labeled[3,Placed["■",p]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.25,VertexShapeFunction->"Square",PlotLabel->p,BaselinePosition->Bottom],{p,{{0,0},{1/2,1/2},{1,1}}}]

Place multiple labels using (RefLink[Placed, paclet:ref/Placed]) in a wrapper:

PlanarGraph[{1,2,Labeled[3,Placed[{"lbl1","lbl2"},{Above,Below}]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Any number of labels can be used:

PlanarGraph[{1,2,Labeled[3,Placed[{"lbl1","lbl2","lbl3","lbl4"},{Above,After,Below,Before}]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Place multiple labels using (RefLink[VertexLabels, paclet:ref/VertexLabels]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->{3->Placed[{"lbl1","lbl2"},{Above,Below}]}]

Use (RefLink[Placed, paclet:ref/Placed]) with symbolic locations to control label placement along an edge:

Table[PlanarGraph[{Labeled[1\[UndirectedEdge]2,Placed["■■",p]],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},PlotLabel->p,VertexSize->Small],{p,{"Start","Middle","End"}}]

Use explicit coordinates to place labels:

Table[PlanarGraph[{Labeled[1\[UndirectedEdge]2,Placed["■■",p]],1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},PlotLabel->p,VertexSize->Small,BaselinePosition->Bottom],{p,{0,1/4,1/3}}]

Place multiple labels using (RefLink[Placed, paclet:ref/Placed]) in a wrapper:

PlanarGraph[{1\[UndirectedEdge]2,Labeled[3\[UndirectedEdge]1,Placed[{"lbl1","lbl2"},{"Start","End"}]],1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Any number of labels can be used:

PlanarGraph[{1\[UndirectedEdge]2,Labeled[3\[UndirectedEdge]1,Placed[{"lbl1","lbl2","lbl3"},{"Start","Middle","End"}]],1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Place multiple labels using (RefLink[EdgeLabels, paclet:ref/EdgeLabels]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{3\[UndirectedEdge]1->Placed[{"lbl1","lbl2"},{"Start","End"}]}]

OpenersExampleSection2(Spacer1)Options  (80)

OpenersExampleSubsection4(Spacer1)DirectedEdges  (2)

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

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

Use (RefLink[DirectedEdges, paclet:ref/DirectedEdges])->(RefLink[False, paclet:ref/False]) to interpret rules as undirected edges:

PlanarGraph[{1->2,1->3,1->4,2->3,2->4,3->4},DirectedEdges->False]

Use (RefLink[DirectedEdge, paclet:ref/DirectedEdge]) or (RefLink[UndirectedEdge, paclet:ref/UndirectedEdge]) to directly specify whether a graph is directed or not:

{PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4}],PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]}

OpenersExampleSubsection5(Spacer1)EdgeLabels  (7)

Label the edge 1<->2:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->"Hello"}]

Label all edges:

el={1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4};

PlanarGraph[el,EdgeLabels->Table[el[[i]]->(Subscript["e", i]),{i,Length[el]}]]

Use any expression as a label:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->,1\[UndirectedEdge]4->,2\[UndirectedEdge]4-> }]

Use (RefLink[Placed, paclet:ref/Placed]) with symbolic locations to control label placement along an edge:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->Placed["■■■",p]},PlotLabel->p],{p,{"Start","Middle","End"}}]

Use explicit coordinates to place labels:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->Placed["■■■",p]},PlotLabel->p,BaselinePosition->Bottom],{p,{0,1/3,1/4}}]

Vary positions within the label:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->Placed["■■■",{1/2,p}]},PlotLabel->p,BaselinePosition->Bottom],{p,{{0,0},{1/2,1/2},{1,1}}}]

Place multiple labels using (RefLink[Placed, paclet:ref/Placed]) in a wrapper:

PlanarGraph[{1\[UndirectedEdge]2,Labeled[3\[UndirectedEdge]1,Placed[{"lbl1","lbl2"},{"Start","End"}]],1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Any number of labels can be used:

PlanarGraph[{1\[UndirectedEdge]2,Labeled[3\[UndirectedEdge]1,Placed[{"lbl1","lbl2","lbl3"},{"Start","Middle","End"}]],1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Place multiple labels using (RefLink[EdgeLabels, paclet:ref/EdgeLabels]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->{1\[UndirectedEdge]2->Placed[{"lbl1","lbl2"},{"Start","End"}]}]

Use automatic labeling by values through (RefLink[Tooltip, paclet:ref/Tooltip]) and (RefLink[StatusArea, paclet:ref/StatusArea]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->Placed["Name",Tooltip]]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeLabels->Placed["Name",StatusArea]]

OpenersExampleSubsection6(Spacer1)EdgeShapeFunction  (6)

Get a list of built-in settings for (RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]):

GraphElementData["Edge"]

Undirected edges including the basic line:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->"Line"]

Lines with different glyphs on the edges:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->ef],{ef,{"BoxLine","DiamondLine","DotLine"}}]

Directed edges including solid arrows:

Table[PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->ef],{ef,GraphElementData["Edge","FilledArrow"]}]

Line arrows:

Table[PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->ef],{ef,GraphElementData["Edge","UnfilledArrow"]}]

Open arrows:

Table[PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->GraphElementData[ef,"ArrowSize"->0.1],PlotLabel->ef],{ef,GraphElementData["Edge","CarvedArrow"]}]

Specify an edge function for an individual edge:

PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->{1\[DirectedEdge]2->"FilledArcArrow"}]

Combine with a different default edge function:

PlanarGraph[{1\[DirectedEdge]2,1\[DirectedEdge]3,1\[DirectedEdge]4,2\[DirectedEdge]3,2\[DirectedEdge]4,3\[DirectedEdge]4},EdgeShapeFunction->{1\[DirectedEdge]2->"FilledArcArrow","CarvedArrow"}]

Draw edges by running a program:

ef[pts_List,e_]:=
Block[{s=0.015,g=},{Arrowheads[{{s,0.33,g},{s,0.67,g}}],Arrow[pts]}]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeShapeFunction->ef]

(RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]) can be combined with (RefLink[EdgeStyle, paclet:ref/EdgeStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->Blue,EdgeShapeFunction->(Line[#1]&)]

(RefLink[EdgeShapeFunction, paclet:ref/EdgeShapeFunction]) has higher priority than (RefLink[EdgeStyle, paclet:ref/EdgeStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->Blue,EdgeShapeFunction->({Red,Line[#1]}&)]

OpenersExampleSubsection7(Spacer1)EdgeStyle  (2)

Style all edges:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->style,PlotLabel->style],{style,{Gray,Dashed,Thick}}]

Style individual edges:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeStyle->{1\[UndirectedEdge]2->Blue,1\[UndirectedEdge]3->Dashed}]

OpenersExampleSubsection8(Spacer1)EdgeWeight  (2)

Specify the weight for all edges:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeWeight->RandomInteger[5,6]]

WeightedAdjacencyMatrix[%]//MatrixForm

Use any numeric expression as a weight:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},EdgeWeight->{a,b,c,d,e,f}]

WeightedAdjacencyMatrix[%]//MatrixForm

OpenersExampleSubsection9(Spacer1)GraphHighlight  (3)

Highlight the vertex 1:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->Medium,GraphHighlight->{1}]

Highlight the edge 1<->2:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->Tiny,GraphHighlight->{1\[UndirectedEdge]2}]

Highlight vertices and edges:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->Tiny,GraphHighlight->{1,2,1\[UndirectedEdge]2,2\[UndirectedEdge]3}]

OpenersExampleSubsection10(Spacer1)GraphHighlightStyle  (2)

Get a list of built-in settings for (RefLink[GraphHighlightStyle, paclet:ref/GraphHighlightStyle]):

GraphElementData["GraphHighlightStyle"]

Use built-in settings for (RefLink[GraphHighlightStyle, paclet:ref/GraphHighlightStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},GraphHighlight->{1,2\[UndirectedEdge]3},VertexSize->Small,GraphHighlightStyle->#,PlotLabel->#]&/@Select[GraphElementData["GraphHighlightStyle"],#=!=Automatic&]

OpenersExampleSubsection11(Spacer1)GraphLayout  (2)

By default, the layout is chosen automatically:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},GraphLayout->Automatic]

Specify layouts on planar graphs:

g=PetersenGraph[5,1];

Table[PlanarGraph[g,GraphLayout->l,PlotLabel->l],{l,{"TutteEmbedding","PlanarEmbedding"}}]

OpenersExampleSubsection12(Spacer1)PlotTheme  (4)

OpenersExampleSubsubsection0(Spacer1)Base Themes  (2)

Use a common base theme:

PlanarGraph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]1},PlotTheme->"Business"]

Use a monochrome theme:

PlanarGraph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]1},PlotTheme->"Monochrome"]

OpenersExampleSubsubsection1(Spacer1)Feature Themes  (2)

Use a large graph theme:

PlanarGraph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]1},PlotTheme->"LargeGraph"]

Use a classic diagram theme:

PlanarGraph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3,3\[UndirectedEdge]1},PlotTheme->"ClassicDiagram"]

OpenersExampleSubsection13(Spacer1)Properties  (3)

Specify a property for vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},Properties->{3->{VertexLabels-> "hello"}}]

Edges:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},Properties->{2\[UndirectedEdge]3->{EdgeLabels-> "hello"}}]

Graph itself:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},Properties->{"GraphProperties"->{"Message"-> "hello"}}]

PropertyValue[%,"Message"]

OpenersExampleSubsection14(Spacer1)VertexCoordinates  (3)

By default, any vertex coordinates are computed automatically:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Extract the resulting vertex coordinates using (RefLink[AbsoluteOptions, paclet:ref/AbsoluteOptions]):

AbsoluteOptions[%,VertexCoordinates]

Specify a layout function along an ellipse:

ellipseLayout[n_,{a_,b_}]:=Table[{a Cos[2Pi/n u],b Sin[2Pi/n u]},{u,1,n}]

Graphics[Point[ellipseLayout[20,{2,1}]]]

Use it to generate vertex coordinates for a graph:

PlanarGraph[Table[1\[UndirectedEdge]i,{i,2,20}],VertexCoordinates->ellipseLayout[20,{2,1}]]

(RefLink[VertexCoordinates, paclet:ref/VertexCoordinates]) has higher priority than (RefLink[GraphLayout, paclet:ref/GraphLayout]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexCoordinates->Table[{i,i},{i,4}],GraphLayout->"TutteEmbedding"]

OpenersExampleSubsection15(Spacer1)VertexLabels  (13)

Use vertex names as labels:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->"Name"]

Label individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->{2->"one"}]

Label all vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Table[i->(Subscript[v, i]),{i,4}]]

Use any expression as a label:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->{1->,2->,4->}]

Use (RefLink[Placed, paclet:ref/Placed]) with symbolic locations to control label placement, including outside positions:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.1,VertexShapeFunction->"Square",VertexLabels->Placed["■■■",p],PlotLabel->p],{p,{Before,After,Below,Above}}]

Symbolic outside corner positions:

pl={{Before,Below},{After,Below},{Before,Above},{After,Above}};

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.1,VertexShapeFunction->"Square",VertexLabels->Placed["■■■",p],PlotLabel->p],{p,pl}]

Symbolic inside positions:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.35,VertexLabels->Placed["■■",p],VertexShapeFunction->"Square",PlotLabel->p],{p,{Left,Top,Right,Bottom}}]

Symbolic inside corner positions:

pl={{Left,Bottom},{Right,Bottom},{Left,Top},{Right,Top}};

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->.6,VertexShapeFunction->"Square",VertexLabels->Placed["■■",p],PlotLabel->p],{p,pl}]

Use explicit coordinates to place the center of labels:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.5,VertexShapeFunction->"Square",VertexLabels->Placed[,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:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.35,VertexShapeFunction->"Square",VertexLabels->Placed[,{{1,1},p}],PlotLabel->p,BaselinePosition->Bottom],{p,{{0,0},{1/2,1/2},{1,1}}}]

Place multiple labels using (RefLink[Placed, paclet:ref/Placed]) in a wrapper:

PlanarGraph[{1,2,Labeled[3,Placed[{"lbl1","lbl2"},{Above,Below}]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Any number of labels can be used:

PlanarGraph[{1,2,Labeled[3,Placed[{"lbl1","lbl2","lbl3","lbl4"},{Above,After,Below,Before}]]},{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

Place multiple labels using (RefLink[VertexLabels, paclet:ref/VertexLabels]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->{3->Placed[{"lbl1","lbl2"},{Above,Below}]}]

Use the argument to (RefLink[Placed, paclet:ref/Placed]) to control formatting including (RefLink[Tooltip, paclet:ref/Tooltip]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Placed["Name",Tooltip]]

Or (RefLink[StatusArea, paclet:ref/StatusArea]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Placed["Name",StatusArea]]

Use more elaborate formatting functions:

rotateLabel[lab_]:=Rotate[lab,45Degree]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Placed["xxx",Below,rotateLabel]]

panelLabel[lab_]:=Panel[lab,FrameMargins->0,Background->Lighter[Yellow,0.7]]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Placed["xxx",Center,panelLabel]]

hyperlinkLabel[lab_]:=Hyperlink[lab,"http://www.wolfram.com"]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexLabels->Placed["xxx",Center,hyperlinkLabel]]

OpenersExampleSubsection16(Spacer1)VertexShape  (5)

Use any (RefLink[Graphics, paclet:ref/Graphics]), (RefLink[Image, paclet:ref/Image]), or (RefLink[Graphics3D, paclet:ref/Graphics3D]) as a vertex shape:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShape->s,VertexSize->0.3],{s,{,,}}]

Specify vertex shapes for individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShape->{2->},VertexSize->0.3]

(RefLink[VertexShape, paclet:ref/VertexShape]) can be combined with (RefLink[VertexSize, paclet:ref/VertexSize]):

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,VertexShape->,PlotLabel->s],{s,{Medium,Large}}]

(RefLink[VertexShape, paclet:ref/VertexShape]) is not affected by (RefLink[VertexStyle, paclet:ref/VertexStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.3,VertexShape->,VertexStyle->Blue]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) has higher priority than (RefLink[VertexShape, paclet:ref/VertexShape]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.2,VertexShapeFunction->"Square",VertexShape->]

OpenersExampleSubsection17(Spacer1)VertexShapeFunction  (10)

Get a list of built-in collections for (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]):

GraphElementData["Vertex"]

Use built-in settings for (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) in the "Basic" collection:

GraphElementData["Vertex","Basic"]

Simple basic shapes:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->vf,VertexSize->0.2,PlotLabel->vf],{vf,{"Triangle","Square","Rectangle","Pentagon","Hexagon","Octagon"}}]

Common basic shapes:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->vf,VertexSize->0.2,PlotLabel->vf],{vf,{"DownTrapezoid","UpTrapezoid","Parallelogram","FiveDown","Circle","Diamond","Star","Capsule"}}]

Use built-in settings for (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) in the "Rounded" collection:

GraphElementData["Vertex","Rounded"]

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->vf,VertexSize->0.2,PlotLabel->vf],{vf,GraphElementData["Vertex","Rounded"]}]

Use built-in settings for (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) in the "Concave" collection:

GraphElementData["Vertex","Concave"]

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->vf,VertexSize->0.2,PlotLabel->vf],{vf,GraphElementData["Vertex","Concave"]}]

Draw individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->{ 1->"Square"},VertexSize->0.2]

Combine with a default vertex function:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->{ 1->"Square","Triangle"},VertexSize->0.2]

Draw vertices using a predefined graphic:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->(Inset[,#]&)]

Draw vertices by running a program:

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}}]
];

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->vf,VertexSize->0.2]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) can be combined with (RefLink[VertexStyle, paclet:ref/VertexStyle]):

vf1[{xc_,yc_},name_,{w_,h_}]:=Rectangle[{xc-w,yc-h},{xc+w,yc+h}]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.2,VertexStyle->Blue,VertexShapeFunction->vf1]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) has higher priority than (RefLink[VertexStyle, paclet:ref/VertexStyle]):

vf2[{xc_,yc_},name_,{w_,h_}]:={Red,Rectangle[{xc-w,yc-h},{xc+w,yc+h}]}

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.2,VertexStyle->Blue,VertexShapeFunction->vf2]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) can be combined with (RefLink[VertexSize, paclet:ref/VertexSize]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexShapeFunction->"Star",VertexSize->{1->Small,Medium}]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) has higher priority than (RefLink[VertexShape, paclet:ref/VertexShape]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.3,VertexShapeFunction->"Star",VertexShape->]

OpenersExampleSubsection18(Spacer1)VertexSize  (8)

By default, the size of vertices is computed automatically:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->Automatic]

Specify the size of all vertices using symbolic vertex size:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,PlotLabel->s],{s,{Tiny,Small,Medium,Large}}]

Use a fraction of the minimum distance between vertex coordinates:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,PlotLabel->s],{s,0.1,1,0.3}]

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

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->{"Scaled", s},PlotLabel->{"Scaled", s}],{s,0.1,1,0.3}]

Specify size in both the x and y directions:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,PlotLabel->s],{s,{{0.1,0.2},{0.2,0.1}}}]

Specify the size for individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->{1->0.2,2->0.3}]

(RefLink[VertexSize, paclet:ref/VertexSize]) can be combined with (RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]):

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,VertexShapeFunction->"Square",PlotLabel->s],{s,{0.05,0.1,0.2}}]

(RefLink[VertexSize, paclet:ref/VertexSize]) can be combined with (RefLink[VertexShape, paclet:ref/VertexShape]):

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->s,VertexShape->,PlotLabel->s],{s,{0.1,0.2,0.4}}]

OpenersExampleSubsection19(Spacer1)VertexStyle  (5)

Style all vertices:

Table[PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->style,VertexSize->0.3,PlotLabel->style],{style,{Yellow,EdgeForm[Dashed]}}]

Style individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->{1->Blue,2->Red},VertexSize->0.2]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) can be combined with (RefLink[VertexStyle, paclet:ref/VertexStyle]):

vf1[{xc_,yc_},name_,{w_,h_}]:=Rectangle[{xc-w,yc-h},{xc+w,yc+h}]

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.2,VertexStyle->Blue,VertexShapeFunction->vf1]

(RefLink[VertexShapeFunction, paclet:ref/VertexShapeFunction]) has higher priority than (RefLink[VertexStyle, paclet:ref/VertexStyle]):

vf2[{xc_,yc_},name_,{w_,h_}]:={Red,Rectangle[{xc-w,yc-h},{xc+w,yc+h}]}

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.2,VertexStyle->Blue,VertexShapeFunction->vf2]

(RefLink[VertexStyle, paclet:ref/VertexStyle]) can be combined with (RefLink[BaseStyle, paclet:ref/BaseStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->LightBlue,BaseStyle->EdgeForm[Dotted],VertexSize->0.2]

(RefLink[VertexStyle, paclet:ref/VertexStyle]) has higher priority than (RefLink[BaseStyle, paclet:ref/BaseStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexStyle->LightBlue,BaseStyle->Gray,VertexSize->0.2]

(RefLink[VertexShape, paclet:ref/VertexShape]) is not affected by (RefLink[VertexStyle, paclet:ref/VertexStyle]):

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexSize->0.3,VertexShape->,VertexStyle->Blue]

OpenersExampleSubsection20(Spacer1)VertexWeight  (3)

Set the weight for all vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexWeight->{2,3,4,5}]

PropertyValue[{%,1},VertexWeight]

Specify the weight for individual vertices:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexWeight->{1->2}]

Use any numeric expression as a weight:

PlanarGraph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,1\[UndirectedEdge]4,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4},VertexWeight->{a,b,c,d}]

PropertyValue[{%,1},VertexWeight]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Graph, paclet:ref/Graph])  ▪  (RefLink[UndirectedEdge, paclet:ref/UndirectedEdge])  ▪  (RefLink[DirectedEdge, paclet:ref/DirectedEdge])  ▪  (RefLink[PlanarGraphQ, paclet:ref/PlanarGraphQ])  ▪  (RefLink[GridGraph, paclet:ref/GridGraph])  ▪  (RefLink[CycleGraph, paclet:ref/CycleGraph])  ▪  (RefLink[HypercubeGraph, paclet:ref/HypercubeGraph])  ▪  (RefLink[StarGraph, paclet:ref/StarGraph])  ▪  (RefLink[WheelGraph, paclet:ref/WheelGraph])  ▪  (RefLink[VoronoiMesh, paclet:ref/VoronoiMesh])  ▪  (RefLink[DelaunayMesh, paclet:ref/DelaunayMesh])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Construction & Representation, paclet:guide/GraphConstructionAndRepresentation])}})}})