EdgeWeight
✖
EdgeWeight
Details

- The following option settings can be used:
-
Automatic automatically determine edge weights {vivj->wij,…} edge has weight
etc.
{w1,w2,…} give all edge weights in the same order as used by EdgeList {patternw,…} edge that matches the pattern has weight w - The wrapper Annotation[vivj,EdgeWeight->w] can be used when creating graphs in functions such as Graph etc.
- The weight
can be any expression.
- The weight
can be interpreted as cost or capacity, or can have other special meanings for different graph computation functions.
Examples
Basic Examples (3)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/0rs1mxfky-8fxi6
Out[1]=1

The weighted adjacency matrix:
In[2]:=2

✖
https://wolfram.com/xid/0rs1mxfky-baprxk

Specify the weight for individual edges:
In[1]:=1

✖
https://wolfram.com/xid/0rs1mxfky-0kqh4
Out[1]=1

The list of edge weights in the order given in the graph:
In[2]:=2

✖
https://wolfram.com/xid/0rs1mxfky-occu4
Out[2]=2

Use any expression as a weight:
In[1]:=1

✖
https://wolfram.com/xid/0rs1mxfky-bcptub
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0rs1mxfky-fibbsw

Wolfram Research (2010), EdgeWeight, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeWeight.html (updated 2020).
✖
Wolfram Research (2010), EdgeWeight, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeWeight.html (updated 2020).
Text
Wolfram Research (2010), EdgeWeight, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeWeight.html (updated 2020).
✖
Wolfram Research (2010), EdgeWeight, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeWeight.html (updated 2020).
CMS
Wolfram Language. 2010. "EdgeWeight." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EdgeWeight.html.
✖
Wolfram Language. 2010. "EdgeWeight." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EdgeWeight.html.
APA
Wolfram Language. (2010). EdgeWeight. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeWeight.html
✖
Wolfram Language. (2010). EdgeWeight. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeWeight.html
BibTeX
✖
@misc{reference.wolfram_2025_edgeweight, author="Wolfram Research", title="{EdgeWeight}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeWeight.html}", note=[Accessed: 16-April-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_edgeweight, organization={Wolfram Research}, title={EdgeWeight}, year={2020}, url={https://reference.wolfram.com/language/ref/EdgeWeight.html}, note=[Accessed: 16-April-2025
]}