EdgeWeight

EdgeWeight

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

Details

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

Examples

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
 (8.0)
 |
Updated in 2020
 (12.1)