MakeWeighted - Maple Help

Online Help

All Products    Maple    MapleSim


GraphTheory

  

MakeWeighted

  

make weighted graph

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MakeWeighted(G)

MakeWeighted(G, M)

Parameters

G

-

unweighted graph

M

-

(optional) Matrix

Description

• 

The MakeWeighted command returns a graph with vertices and edges from G. If M is part of the input, then the edge weights are taken from it; otherwise edge weights are assumed to be 1. If G is undirected, then M is assumed to be a symmetric matrix.

• 

For efficiency, use datatype=integer for wordsize integer weights and datatype=float[8] for numerical (decimal) edge weights.

• 

To read or modify the edge weights of a weighted graph, use the GetEdgeWeight and SetEdgeWeight commands.

Examples

withGraphTheory:

GGraph1,2,1,3,2,3

GGraph 1: an undirected unweighted graph with 3 vertices and 3 edge(s)

(1)

MMatrix0,2,3,2,0,1,3,1,0

M023201310

(2)

H1MakeWeightedG,M

H1Graph 2: an undirected weighted graph with 3 vertices and 3 edge(s)

(3)

EdgesH1

1,2,1,3,2,3

(4)

WeightMatrixH1

023201310

(5)

MMatrixM,datatype=float8,shape=symmetric

M0.2.3.2.0.1.3.1.0.

(6)

H2MakeWeightedG,M

H2Graph 3: an undirected weighted graph with 3 vertices and 3 edge(s)

(7)

WeightMatrixH2

0.2.3.2.0.1.3.1.0.

(8)

See Also

GetEdgeWeight

IsWeighted

MakeDirected

SetEdgeWeight

UnderlyingGraph

WeightMatrix