Note
lWe are assuming that every node in the graph is on one or the other end of an arc, i.e. there are no isolated nodes, as in the graph below.
lOtherwise, weĠd have to represent the graph with two lists: one of nodes and one of arcs.
a
b
c
d
e
isolated
node