VertexLabels

VertexLabels
is an option and property for Graph and related functions that specifies what labels and label positions should be used for vertices.

DetailsDetails

  • The following option settings can be used:
  • Noneuse no vertex labels
    Automaticautomatically label vertices
    "Name"use the vertex name as a label
    {v1->lbl1,v2->lbl2,}label vertex with etc.
  • The wrapper Labeled[v,lbl] is equivalent to Property[v,VertexLabels->lbl] and can be used when creating graphs in functions such as Graph etc.
  • Any expression can be used as a label.
  • Labeled[v,lbl,pos] and Placed[lbl,pos] can be used to place labels in relative position to the vertex box.
  • The following positions pos can be used for Labeled and Placed in positioning vertex labels:
  • Tooltip, StatusAreashow as tooltip or in status area on mouseover
    Centerplace label at center of vertex
    Before,After,Below,Aboveplace label outside before, after, etc.
    Left,Right,Bottom,Topplace label inside to the left, right, etc.
    {Before,Below},{After,Below},place label outside at corner before/below, etc.
    {Left,Bottom},{Right,Bottom},place label inside at corner left/bottom, etc.
    {{vx,vy},{lx,ly}}scaled position in the label at scaled position in the vertex

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Label individual vertices:

In[1]:=
Click for copyable input
Out[1]=

Label all vertices:

In[1]:=
Click for copyable input
Out[1]=

Use any expression as a label:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2010
(8.0)