is an option and annotation for Graph and related functions that specifies an edge weight.


  • The following option settings can be used:
  • Automaticautomatically 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.


Basic Examples  (3)

Set a weight for all edges:

The weighted adjacency matrix:

Specify the weight for individual edges:

The list of edge weights in the order given in the graph:

Use any expression as a weight:

Introduced in 2010
Updated in 2020