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
GetEdgeWeight(G, e)
SetEdgeWeight(G, e, w)
GetEdgeWeights(G, edges)
SetEdgeWeights(G, eqs)
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
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.
with⁡GraphTheory:
G≔MakeWeighted⁡CompleteGraph⁡4
G≔Graph 1: an undirected weighted graph with 4 vertices and 6 edge(s)
GetEdgeWeight⁡G,1,2
1
SetEdgeWeight⁡G,1,2,3
3
foreinEdges⁡CycleGraph⁡4doSetEdgeWeight⁡G,e,2enddo
WeightMatrix⁡G
0212202112022120
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
Download Help Document