Adjacency Lists
Nowadays, RPLACA and RPLACD are less used.
Straight lists are more common.
Memory space is less of a concern.
(setq nodes '(a b c d))
(setq arc-lists '(
(a (b c))
(b (d))
(c (d))
(d ())
) )
(defun is-edge (x y)
(member y (second (assoc x arc-lists))) )
(is-edge 'a 'c) ; => (C) i.e., true.
(is-edge 'a 'd) ; => NIL
A
C
B
D
Previous slide
Next slide
Back to first slide
View graphic version