This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

VertexLabels

VertexLabels
is an option and property for Graph and related functions that specifies what labels and label positions should be used for vertices.
  • 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 is equivalent to Property and can be used when creating graphs in functions such as Graph etc.
  • Any expression can be used as a label.
  • Labeled and Placed 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
Label individual vertices:
Label all vertices:
Use any expression as a label:
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]=
Use vertex names as labels:
VertexLabels can be used for general graphs:
Matrix graphs:
Special graphs:
Random graphs:
Use VertexLabels in a Property wrapper:
Alternatively, use a Labeled wrapper:
Use Placed with symbolic locations to control label placement, including outside positions:
Symbolic outside corner positions:
Symbolic inside positions:
Symbolic inside corner positions:
Use explicit coordinates to place the center of labels:
Place all labels at the upper-right corner of the vertex and vary the coordinates within the label:
Place multiple labels using Placed in a wrapper:
Any number of labels can be used:
Place multiple labels using VertexLabels:
Use the third argument to Placed to control formatting including Tooltip:
Use more elaborate formatting functions:
New in 8