GraphTheory - Maple Programming Help

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

GraphTheory

 WeightMatrix

 Calling Sequence WeightMatrix(G, cp)

Parameters

 G - weighted graph cp - (optional) symbol or equation

Description

 • WeightMatrix returns the matrix of edge weights of a weighted graph. The optional argument cp is used to control whether the weight matrix of the graph or a copy of it should be returned. The argument cp can be either the symbol copy or an equation of the form copy=true or copy=false. If the argument is missing the command returns a copy of the weight matrix of the graph by default.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Graph}\left(\left\{\left[\left\{1,2\right\},2\right],\left[\left\{2,3\right\},1\right]\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected weighted graph with 3 vertices and 2 edge\left(s\right)}}$ (1)
 > $\mathrm{WeightMatrix}\left(G\right)$
 $\left[\begin{array}{ccc}{0}& {2}& {0}\\ {2}& {0}& {1}\\ {0}& {1}& {0}\end{array}\right]$ (2)