GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/SetEdgeWeight

GraphTheory

  

SetEdgeWeight

  

GetEdgeWeight

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

SetEdgeWeight(G, e, w)

GetEdgeWeight(G, e)

Parameters

G

-

weighted graph

e

-

edge/arc

w

-

numeric; edge weight

Description

• 

SetEdgeWeight is used to change the weight of an edge of a weighted graph. It returns the old weight of the edge.

• 

GetEdgeWeight is used to get the weight of an edge of a weighted graph.

Examples

withGraphTheory:

GMakeWeightedCompleteGraph4

GGraph 1: an undirected weighted graph with 4 vertices and 6 edge(s)

(1)

GetEdgeWeightG,1,2

1

(2)

SetEdgeWeightG,1,2,3

1

(3)

GetEdgeWeightG,1,2

3

(4)

foreinEdgesCycleGraph4doSetEdgeWeightG,e,2end do

1

(5)

WeightMatrixG

0212202112022120

(6)

See Also

IsWeighted

MakeWeighted

WeightMatrix