VertexLabels

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:
  • Noneuse no vertex labels
    Allalways use vertex labels
    Automaticautomatically 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:
  • 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 {lx,ly} in the label at scaled position {vx,vy} in the vertex

Examples

open allclose all

Basic 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:

Wolfram Research (2010), VertexLabels, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexLabels.html (updated 2015).

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_2023_vertexlabels, author="Wolfram Research", title="{VertexLabels}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexLabels.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_vertexlabels, organization={Wolfram Research}, title={VertexLabels}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexLabels.html}, note=[Accessed: 29-March-2024 ]}