chickadee » graphs » graph-edge-add

(graph-edge-add (G <multidigraph>) u v id [#!rest attr])method
(graph-edge-add (G <multigraph>) u v id [#!rest attr])method
(graph-edge-add (G <digraph>) u v [#!rest attr])method
(graph-edge-add (G <graph>) u v [#!rest attr])method
(graph-edge-add! (G <multidigraph>) u v id [#!rest attr])method
(graph-edge-add! (G <multigraph>) u v id [#!rest attr])method
(graph-edge-add! (G <digraph>) u v [#!rest attr])method
(graph-edge-add! (G <graph>) u v [#!rest attr])method

Adds an edge u->v to the graph G. Optional attributes can be added as keyword / value pairs in attr. Note that for multigraph-types, an identifier (id) is needed to distinguish edges (can be anything that compares with equal?). For undirected graph types this adds u->v and v->u to the graph since the distinction is meaningless.

Raises an error if the edge already exists or already exists with the ID id. If either of the vertices u or v do not exist when this method is called, they are first added to the graph, and the edge added afterwards.

G
the graph to add the edge to
u
the head vertex
v
the tail vertex
id
an identifier (compares with equal?) for the edge (in cases where multiple edges can exist). NOTE: Do not set id to be #f, as this can cause problems with removing edges later, and makes no logical sense.
attr
a list of keyword / value pairs