AddArc - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

AddArc

  

add arc to graph

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

AddArc(G, E)

AddArc(G, E, ip)

Parameters

G

-

directed graph

E

-

arc, trail, or set of arcs

ip

-

(optional) equation of the form inplace=true or false

Description

• 

The AddArc command adds one or more arcs to a directed graph. By default, the original digraph is changed to a digraph containing the specified set of arc(s).  By setting inplace=false, the original digraph remains unchanged and a new digraph containing the specified set of arcs is created.

• 

If the graph is weighted, then a weighted arc can be added by calling AddArc with one or more arcs in the form arc,weight, where the arc is just the from/to vertex pair, and the weight represents the value of the arc weight.

Examples

withGraphTheory:

GDigrapha,b,c,d,e,a,b,b,c,c,d,d,e

GGraph 1: a directed graph with 5 vertices and 4 arc(s)

(1)

AddArcG,a,c,inplace=false

Graph 2: a directed graph with 5 vertices and 5 arc(s)

(2)

G

Graph 1: a directed graph with 5 vertices and 4 arc(s)

(3)

AddArcG,a,c,b,d,inplace=false

Graph 3: a directed graph with 5 vertices and 6 arc(s)

(4)

AddArcG,a,c,b,d

Graph 1: a directed graph with 5 vertices and 6 arc(s)

(5)

G

Graph 1: a directed graph with 5 vertices and 6 arc(s)

(6)

GwGraphMatrix0,1,1,0,1,0,0,3,`$``$`0,4,2,weighted,directed

GwGraph 4: a directed weighted graph with 4 vertices and 4 arc(s)

(7)

EdgesGw,weights

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

(8)

AddArcGw,1,4,2

Graph 4: a directed weighted graph with 4 vertices and 5 arc(s)

(9)

EdgesGw,weights

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

(10)

GDigraph1,3,5,7

GGraph 5: a directed graph with 4 vertices and 0 arc(s)

(11)

AddArcG,Trail1,5,3,7,1

Graph 5: a directed graph with 4 vertices and 4 arc(s)

(12)

EdgesG

1,5,3,7,5,3,7,1

(13)

See Also

AddEdge

DeleteArc

Digraph

Edges

HasArc

Trail