is an option and annotation for Graph and related functions that specifies what labels and label positions should be used for vertices.
VertexLabels
is an option and annotation for Graph and related functions that specifies what labels and label positions should be used for vertices.
Details
- The following option settings can be used:
-
None use no vertex labelsAll always use vertex labelsAutomatic automatically label vertices"Index" use the vertex index as a label"Name" use the vertex name as a label"VertexWeight" use the vertex weight as a label{v1lbl1,v2lbl2,…} label vertex vi with lbli etc.{patt1lbl1,patt2lbl2,…} label vertices matching the pattern patti with lbli
- The wrapper Labeled [v,lbl] is equivalent to Annotation [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:
-
Center place label at center of vertex{{vx,vy},{lx,ly}} scaled position {lx,ly} in the label at scaled position {vx,vy} in the vertex
Examples
open all close allBasic Examples (4)
Label individual vertices:
Label all vertices:
Use any expression as a label:
Place labels at the center of vertices:
Scope (18)
Label Specification (9)
Use vertex names as labels:
Use vertex indices as labels:
Use vertex weights as labels:
VertexLabels can be used for general graphs:
Matrix graphs:
Special graphs:
Random graphs:
Use VertexLabels in an Annotation wrapper:
Alternatively, use a Labeled wrapper:
VertexLabels works with patterns:
Label Placement (9)
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 second argument to Placed to control formatting including Tooltip :
Or StatusArea :
Use more elaborate formatting functions:
Related Guides
Text
Wolfram Research (2010), VertexLabels, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexLabels.html (updated 2015).
CMS
Wolfram Language. 2010. "VertexLabels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexLabels.html.
APA
Wolfram Language. (2010). VertexLabels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexLabels.html
BibTeX
@misc{reference.wolfram_2025_vertexlabels, author="Wolfram Research", title="{VertexLabels}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexLabels.html}", note=[Accessed: 04-January-2026]}
BibLaTeX
@online{reference.wolfram_2025_vertexlabels, organization={Wolfram Research}, title={VertexLabels}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexLabels.html}, note=[Accessed: 04-January-2026]}