GraphTheory[AddArc] - Maple Help

Online Help

All Products    Maple    MapleSim


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

GraphTheory[AddArc]

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:

G:=Digrapha,b,c,d,e,a,b,b,c,c,d,d,e:

AddArcG,a,c,inplace=false

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

(1)

G

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

(2)

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

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

(3)

AddArcG,a,c,b,d

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

(4)

G

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

(5)

Gw:=GraphMatrix0,1,1,0,1,0,0,3,0$4$2,'weighted','directed'

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

(6)

EdgesGw,weights

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

(7)

AddArcGw,1,4,2

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

(8)

EdgesGw,weights

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

(9)

G:=Digraph1,3,5,7

G:=Graph 5: a directed unweighted graph with 4 vertices and 0 arc(s)

(10)

AddArcG,Trail1,5,3,7,1

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

(11)

EdgesG

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

(12)

See Also

AddEdge, DeleteArc, Digraph, Edges, HasArc, Trail


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam