GraphTheory - 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

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

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

(1)

AddArcG,a,c,inplace=false

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

(2)

G

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

(3)

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

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

(4)

AddArcG,a,c,b,d

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

(5)

G

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

(6)

GwGraphMatrix0,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)

(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

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

(11)

AddArcG,Trail1,5,3,7,1

Graph 5: a directed unweighted 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

 


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