Close
Close window
AddEdge - 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

AddEdge

add edge to graph

Calling Sequence

AddEdge(G, E)

AddEdge(G, E, ip)

Parameters

G

-

undirected graph

E

-

edge, trail, or set of edges

ip

-

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

Description

The AddEdge command adds one or more edges to an undirected graph. By default, the original graph is changed to a graph containing the specified set of edge(s). By setting inplace=false the original graph remains unchanged and a new graph containing the specified set of edges is created.

If the graph is weighted, then a weighted edge can be added by calling AddEdge with one or more edges in the form edge,weight, where the edge is just the set of two vertices, and the weight represents the value of the edge weight.

Examples

>

withGraphTheory:

>

GCycleGraph5

GGraph 1: an undirected graph with 5 vertices and 5 edges

(1)
>

AddEdgeG,1,3,inplace=false

Graph 2: an undirected graph with 5 vertices and 6 edges

(2)
>

G

Graph 1: an undirected graph with 5 vertices and 5 edges

(3)
>

AddEdgeG,1,3,2,4,inplace=false

Graph 3: an undirected graph with 5 vertices and 7 edges

(4)
>

AddEdgeG,1,3,2,4

Graph 1: an undirected graph with 5 vertices and 7 edges

(5)
>

G

Graph 1: an undirected graph with 5 vertices and 7 edges

(6)
>

GwGraphMatrix0,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,weighted

GwGraph 4: an undirected weighted graph with 4 vertices and 3 edges

(7)
>

EdgesGw,weights

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

(8)
>

AddEdgeGw,1,4,2

Graph 4: an undirected weighted graph with 4 vertices and 4 edges

(9)
>

EdgesGw,weights

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

(10)
>

GGrapha,b,c,d

GGraph 5: an undirected graph with 4 vertices and 0 edges

(11)
>

AddEdgeG,Traila,b,c,d,a

Graph 5: an undirected graph with 4 vertices and 4 edges

(12)
>

EdgesG

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

(13)


Download Help Document

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