EdgeLabels

EdgeLabels

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)

Label the edge 12:

Use any expression as a label:

Place a label along the edge:

Scope  (14)

Label Specification  (10)

Label all edges:

Use edge names as labels:

Use edge indices as labels:

Use edge weights as labels:

EdgeLabels can be used for general graphs:

Matrix graphs:

Special graphs:

Random graphs:

Use EdgeLabels in an Annotation wrapper:

Alternatively, use a Labeled wrapper:

EdgeLabels works with patterns:

Label Placement  (4)

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

Use explicit coordinates to place labels:

Place multiple labels using Placed in a wrapper:

Any number of labels can be used:

Place multiple labels using EdgeLabels:

Use automatic labeling by values through Tooltip and StatusArea:

Possible Issues  (1)

Using Rule to indicate edges does not work:

Use parentheses to get correct parsing:

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).

CMS

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

BibTeX

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

BibLaTeX

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