add-edge ( graph tail head -- graph' )
Graphviz > Graphviz data structures

Prev:add-node ( graph id -- graph' )
Next:add-nodes ( graph nodes -- graph' )


Vocabulary
graphviz

Inputs and outputs
grapha graph or a subgraph
tailan object
headan object
graph'a graph or a subgraph


Word description
Adds an edge in graph from tail to head. That is,
X Y add-edge

is shorthand for
X Y <edge> add


Examples
USING: accessors graphviz io kernel sequences ; <graph> 1 2 add-edge 3 4 add-edge 1 2 add-edge ! duplicate 5 6 add-edge statements>> [ dup tail>> write "--" write head>> print ] each
1--2 3--4 1--2 5--6


USING: accessors graphviz io kernel math.combinatorics sequences ; <graph> { "a" 2 "c" } 2 [ first2 add-edge ] each-combination statements>> [ dup tail>> write "--" write head>> print ] each
a--2 a--c 2--c


See also
->, ~->

Definition

: add-edge ( graph tail head -- graph' ) <edge> add ; inline