GraphTheory
DeleteEdge
delete edge from graph
Calling Sequence
Parameters
Description
Examples
DeleteEdge(G, E, ip)
G
-
undirected graph
E
edge, trail, or set of edges
ip
(optional) equation of the form inplace=true or false
The DeleteEdge command deletes one or more edges from an undirected graph. By default, the original graph is changed to a graph missing the specified set of edges. By setting inplace=false the original graph remains unchanged and a new graph missing the specified set of edges is created.
If the graph is a weighted graph, then if a weight is also provided (i.e. edge,weight instead of edge) that weight is subtracted from the edge weight, which will not necessarily remove the edge from the graph. If no weight is provided, the edge is removed regardless of the weight.
with⁡GraphTheory:
G≔CycleGraph⁡4
G≔Graph 1: an undirected graph with 4 vertices and 4 edge(s)
H≔DeleteEdge⁡G,1,2,inplace=false
H≔Graph 2: an undirected graph with 4 vertices and 3 edge(s)
Edges⁡G
1,2,1,4,2,3,3,4
Edges⁡H
1,4,2,3,3,4
DeleteEdge⁡G,1,2,3,4
Graph 1: an undirected graph with 4 vertices and 2 edge(s)
1,4,2,3
See Also
AddEdge
CycleGraph
DeleteArc
Edges
Graph
HasEdge
Trail
Download Help Document