Close
Close window
Digraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

GraphTheory

Digraph

construct a directed graph

Calling Sequence

Digraph(V, opts)

Digraph(L, opts)

Digraph(V, L, opts)

Digraph(V, E, A, opts)

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)

opts

-

(optional) one or more options as specified below

Options

The opts parameter is used to specify one or more additional properties of the graph.

weighted or weighted=true

Specifies that this graph has weighted edges.

unweighted or weighted=false

Specifies that this graph has no edge weights.

edgelabels=e

Specifies labels for the edges for use with DrawGraph . The value is a set of equations in which the left-hand side of each equation is an edge and the right-hand side is a string specifying the desired label.

Each edge must be expressed as a list of vertices if the graph is directed and as a set of vertices if it is undirected.

The default is the empty set.

selfloops=truefalse

Specifies whether self-loops should be permitted in the graph. If false, an error will be issued if the edge information provided with parameters E, L, T, or A contains a self-loop. The default is true.

vertexcolor=c

Specifies a color or list of colors to associate with the vertices in vertex order.

vertexlabels=p

Specifies labels for the vertices for use with DrawGraph .

vertexpositions=p

Specifies coordinate positions for the vertices for use with DrawGraph .

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

>

withGraphTheory:

>

GDigraph1,2,2,3,3,4,4,1

GGraph 1: a directed graph with 4 vertices and 4 arcs

(1)
>

DrawGraphG

>

DrawGraphG,style=circle

>

IsDirectedG

true

(2)
>

IsStronglyConnectedG

true

(3)
>

GDigraph2,3,4,1

GGraph 2: a directed graph with 4 vertices and 4 arcs

(4)
>

EdgesG

1,2,2,3,3,4,4,1

(5)
>

Va,b,c,d:

>

Ea,b,1.0,a,c,2.3,b,d,3.1,c,d,4:

>

GDigraphV,E

GGraph 3: a directed weighted graph with 4 vertices and 4 arcs

(6)
>

DrawGraphG

>

IsStronglyConnectedG

false

(7)
>

IsNetworkG

a,d

(8)
>

DrawNetworkG

>

EdgesG

a,b,a,c,b,d,c,d

(9)
>

WeightMatrixG

01.02.300003.100040000

(10)

Compatibility

The selfloops option was introduced in Maple 2020.

For more information on Maple 2020 changes, see Updates in Maple 2020 .

The GraphTheory[Digraph] command was updated in Maple 2025.

The edgelabels and vertexlabels options were introduced in Maple 2025.

For more information on Maple 2025 changes, see Updates in Maple 2025 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /