Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

EdgeWeight

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

DetailsDetails

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

ExamplesExamplesopen allclose all

Basic Examples  (2)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=
Introduced in 2010
(8.0)