GraphTheory - Maple Programming Help

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

GraphTheory

 MakeDirected

 Calling Sequence MakeDirected(G) MakeDirected(G, M)

Parameters

 G - undirected graph M - (optional) Matrix

Description

 • The MakeDirected command returns a directed graph with vertices from G. For each edge in G, the arcs in both directions are in the new graph. If G is a weighted graph, then a matrix M may be included as part of the input; in such a case the arc weights are taken from the entries of M.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{MakeDirected}\left(\mathrm{CycleGraph}\left(4\right)\right):$
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{1}{,}{2}\right]{,}\left[{1}{,}{4}\right]{,}\left[{2}{,}{1}\right]{,}\left[{2}{,}{3}\right]{,}\left[{3}{,}{2}\right]{,}\left[{3}{,}{4}\right]{,}\left[{4}{,}{1}\right]{,}\left[{4}{,}{3}\right]\right\}$ (1)
 > $G≔\mathrm{MakeWeighted}\left(\mathrm{CycleGraph}\left(4\right)\right):$
 > $M≔\mathrm{Matrix}\left(\left[\left[0,0,0,1\right],\left[2,0,1,3\right],\left[0,1,0,4\right],\left[5,0,4,0\right]\right]\right):$
 > $G≔\mathrm{MakeDirected}\left(G,M\right):$
 > $\mathrm{Edges}\left(G,'\mathrm{weights}'\right)$
 $\left\{\left[\left[{1}{,}{4}\right]{,}{1}\right]{,}\left[\left[{2}{,}{1}\right]{,}{2}\right]{,}\left[\left[{2}{,}{3}\right]{,}{1}\right]{,}\left[\left[{2}{,}{4}\right]{,}{3}\right]{,}\left[\left[{3}{,}{2}\right]{,}{1}\right]{,}\left[\left[{3}{,}{4}\right]{,}{4}\right]{,}\left[\left[{4}{,}{1}\right]{,}{5}\right]{,}\left[\left[{4}{,}{3}\right]{,}{4}\right]\right\}$ (2)