GraphTheory
MakeDirected
make graph directed
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
MakeDirected(G, M)
MakeDirected(G, opts)
G

undirected graph
M
(optional) Matrix
opts
(optional) one or more options as specified below
root = vertex of G
In the case when G is a tree, specifies a root vertex for an arborescence with all undirected edges in G converted to directed edges heading away from root.
totalorder = list of vertices
Specifies a total ordering for the vertices. When this option is provided, an undirected edge between vertices a and b is transformed to a single directed edge based on the total order.
The MakeDirected command returns a directed graph with vertices from G.
By default, 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.
$\mathrm{with}\left(\mathrm{GraphTheory}\right)\:$
$G\u2254\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\}$
$G\u2254\mathrm{MakeWeighted}\left(\mathrm{CycleGraph}\left(4\right)\right)\:$
$M\u2254\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\u2254\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\}$
The GraphTheory[MakeDirected] command was updated in Maple 2021.
See Also
IsDirected
MakeWeighted
UnderlyingGraph
Download Help Document
What kind of issue would you like to report? (Optional)