GetEdgeWeight - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

GetEdgeWeight

  

get edge weight

  

SetEdgeWeight

  

set edge weight

  

GetEdgeWeights

  

get multiple edge weights

  

SetEdgeWeights

  

set multiple edge weights

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

GetEdgeWeight(G, e)

SetEdgeWeight(G, e, w)

GetEdgeWeights(G, edges)

SetEdgeWeights(G, eqs)

Parameters

G

-

weighted graph

e

-

edge/arc

w

-

numeric; edge weight

edges

-

list or set of edges/arcs

eqs

-

list or set of equations of the form edge/arc = numeric

Description

• 

GetEdgeWeight returns the weight of an edge of a weighted graph.

• 

SetEdgeWeight updates the weight of an edge of a weighted graph. It returns the old weight of the edge.

• 

GetEdgeWeights(G, edges) accepts a list or set edges and returns a list or set of the corresponding edge weights.

• 

SetEdgeWeights(G, eqs) accepts a list or set eqs of equations whose left-hand side is an edge and whose right-hand side is a weight. It updates the edge weights in G correspondingly.

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,2enddo

1

(5)

WeightMatrixG

0212202112022120

(6)

Compatibility

• 

The GraphTheory[GetEdgeWeights] and GraphTheory[SetEdgeWeights] commands were introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.

See Also

IsWeighted

MakeWeighted

WeightMatrix