EdgeWeight

EdgeWeight

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

Details

  • The following option settings can be used:
  • {w1,w2,}give all edge weights in the same order as used by EdgeList
  • The wrapper Property[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  (2)

Set a weight for all edges:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Use any numeric expression as a weight:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

See Also

Graph  EdgeLabels  VertexWeight  FindShortestPath

Introduced in 2010
(8.0)