WOLFRAM

is an option and annotation for Graph and related functions that specifies what labels and label positions should be used for edges.

Details

  • The following option settings can be used:
  • Noneuse no edge labels
    "Index"use the edge index as a label
    "Name"use the edge name as a label
    "EdgeWeight"use the edge weight as a label
    "EdgeTag"use the edge tag as a label
    {vivj->lblij,}label edge vivj with lblij etc.
    {pattilbli,}use lbli for edges matching the pattern patti
  • The wrapper Labeled[vivj,lbl] is equivalent to Annotation[vivj,EdgeLabels->lbl] and can be used when creating graphs in functions such as Graph etc.
  • Labeled[vivj,lbl,pos] and Placed[lbl,pos] can be used to place labels along an edge.
  • The following positions pos can be used for Labeled and Placed in positioning edge labels:
  • Tooltip,StatusAreashow as tooltip or in status area on mouseover
    "Start","Middle","End"place label at start, middle, or end
    {Left,pos},{Right,pos}place label left or right of the edge at symbolic position
    {s,{lx,ly}}scaled position {lx,ly} in the label at scaled position s along the edge
  • The scaled position along the edge curve represents the fraction of the total length: e.g. places the edge label at the halfway point.

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Label the edge 12:

Out[1]=1

Use any expression as a label:

Out[1]=1

Place a label along the edge:

Out[1]=1

Scope  (14)Survey of the scope of standard use cases

Label Specification  (10)

Label all edges:

Out[2]=2

Use edge names as labels:

Out[1]=1

Use edge indices as labels:

Out[1]=1

Use edge weights as labels:

Out[1]=1

EdgeLabels can be used for general graphs:

Out[1]=1

Matrix graphs:

Out[1]=1

Special graphs:

Out[1]=1

Random graphs:

Out[1]=1

Use EdgeLabels in an Annotation wrapper:

Out[1]=1
Out[2]=2

Alternatively, use a Labeled wrapper:

Out[3]=3

EdgeLabels works with patterns:

Out[1]=1

Label Placement  (4)

Use Placed with symbolic locations to control label placement along an edge:

Out[1]=1

Use explicit coordinates to place labels:

Out[1]=1
Out[2]=2

Place multiple labels using Placed in a wrapper:

Out[1]=1

Any number of labels can be used:

Out[2]=2

Place multiple labels using EdgeLabels:

Out[3]=3

Use automatic labeling by values through Tooltip and StatusArea:

Out[1]=1
Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

Using Rule to indicate edges does not work:

Out[1]=1

Use parentheses to get correct parsing:

Out[4]=4
Wolfram Research (2010), EdgeLabels, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeLabels.html (updated 2020).
Wolfram Research (2010), EdgeLabels, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeLabels.html (updated 2020).

Text

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

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

CMS

Wolfram Language. 2010. "EdgeLabels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EdgeLabels.html.

Wolfram Language. 2010. "EdgeLabels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EdgeLabels.html.

APA

Wolfram Language. (2010). EdgeLabels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeLabels.html

Wolfram Language. (2010). EdgeLabels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeLabels.html

BibTeX

@misc{reference.wolfram_2025_edgelabels, author="Wolfram Research", title="{EdgeLabels}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeLabels.html}", note=[Accessed: 29-March-2025 ]}

@misc{reference.wolfram_2025_edgelabels, author="Wolfram Research", title="{EdgeLabels}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeLabels.html}", note=[Accessed: 29-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_edgelabels, organization={Wolfram Research}, title={EdgeLabels}, year={2020}, url={https://reference.wolfram.com/language/ref/EdgeLabels.html}, note=[Accessed: 29-March-2025 ]}

@online{reference.wolfram_2025_edgelabels, organization={Wolfram Research}, title={EdgeLabels}, year={2020}, url={https://reference.wolfram.com/language/ref/EdgeLabels.html}, note=[Accessed: 29-March-2025 ]}