GraphTheory - Maple Programming Help

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

GraphTheory

 Digraph

 Calling Sequence Digraph(V) Digraph(L) Digraph(V, L) Digraph(V, E, A, W)

Parameters

 V - list of vertices or number of vertices E - set of arcs L - Array or list of sets of vertices indicating vertex neighbors A - adjacency Matrix (edge weights) W - (optional) one of weighted or unweighted, or an equation weighted=true or false

Description

 • The Digraph command creates a digraph (directed graph) with the given parameters. The input parameters may appear in any order; however, they must be compatible.
 • A detailed description of the meaning of each parameter is found in the Graph help page.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Digraph}\left(\left\{\left[1,2\right],\left[2,3\right],\left[3,4\right],\left[4,1\right]\right\}\right)$
 ${G}{:=}{\mathrm{Graph 1: a directed unweighted graph with 4 vertices and 4 arc\left(s\right)}}$ (1)
 > $\mathrm{DrawGraph}\left(G\right)$
 > $\mathrm{DrawGraph}\left(G,\mathrm{style}=\mathrm{circle}\right)$
 > $\mathrm{IsDirected}\left(G\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{IsStronglyConnected}\left(G\right)$
 ${\mathrm{true}}$ (3)
 > $G≔\mathrm{Digraph}\left(\left[\left\{2\right\},\left\{3\right\},\left\{4\right\},\left\{1\right\}\right]\right)$
 ${G}{:=}{\mathrm{Graph 2: a directed unweighted graph with 4 vertices and 4 arc\left(s\right)}}$ (4)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{1}{,}{2}\right]{,}\left[{2}{,}{3}\right]{,}\left[{3}{,}{4}\right]{,}\left[{4}{,}{1}\right]\right\}$ (5)
 > $V≔\left[a,b,c,d\right]:$
 > $E≔\left\{\left[\left[a,b\right],1.0\right],\left[\left[a,c\right],2.3\right],\left[\left[b,d\right],3.1\right],\left[\left[c,d\right],4\right]\right\}:$
 > $G≔\mathrm{Digraph}\left(V,E\right)$
 ${G}{:=}{\mathrm{Graph 3: a directed weighted graph with 4 vertices and 4 arc\left(s\right)}}$ (6)
 > $\mathrm{DrawGraph}\left(G\right)$
 > $\mathrm{IsStronglyConnected}\left(G\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{IsNetwork}\left(G\right)$
 $\left\{{a}\right\}{,}\left\{{d}\right\}$ (8)
 > $\mathrm{DrawNetwork}\left(G\right)$
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{a}{,}{b}\right]{,}\left[{a}{,}{c}\right]{,}\left[{b}{,}{d}\right]{,}\left[{c}{,}{d}\right]\right\}$ (9)
 > $\mathrm{WeightMatrix}\left(G\right)$
 $\left[\begin{array}{cccc}{0}& {1.0}& {2.3}& {0}\\ {0}& {0}& {0}& {3.1}\\ {0}& {0}& {0}& {4}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (10)