anchor.diff:    (car node))
   
   
  -; weighted directed graph implementation
  -; the graph is a list of nodes
  -; a node is a list whose first element is the name of the node
  -; and whose remaining elements are pairs of a neighbours name 
  -; and cost the to that neighbour
  -; (set-graph '((a (b 3)) (b (c 1) (d 5)) (c (d 2)) (d (b 2))))
  +;;; weighted directed graph implementation
  +;;; the graph is a list of nodes
  +;;; a node is a list whose first element is the name of the node
  +;;; and whose remaining elements are pairs of a neighbours name 
  +;;; and cost the to that neighbour
  +;;; (set-graph '((a (b 3)) (b (c 1) (d 5)) (c (d 2)) (d (b 2))))
   
   (setq graph nil)
   (defun set-graph (graph-as-list)
  
positive.code:   (setq candidates (list start)))
  
  (defun add-candidate (node)
    (setq candidate (append candidate (list node)))  
    (setq candidates (sort candidates (lambda (left right)  (< (path-cost left) (path-cost right))))))
  
  (defun min-candidate ()
    (pop candidates))
  
  ; nodes are stored as (name cost)
  (defun cost-to-neighbour (node)
    (cadr node))
  
  
negative.code:         (t (append (flatten (car llist)) (flatten (cdr llist))))))
  
  (defun update-path-cost (end path-cost)
    (setq path-costs 
          (append (remove-if #'(lambda (node) (equal (car node) end)) 
                             path-costs) 
                  (list (list end path-cost)))))
  
  ;;; takes the name of a node
  (defun path-cost (target)
    (cadar (remove-if-not #'(lambda (node) (equal (car node) target)) 
                          path-costs)))
  
  ;;; keep track of the predecessor of each node on the shortest path to the start node
  (defun init-predecessors (graph)
    (setq predecessors (mapcar #'(lambda (node) (list node nil)) 
                               (list-nodes graph))))
  
  ;;; end and predecessor are names of a nodes
  (defun update-predecessor (end predecessor)
    (setq predecessors (append (remove-if #'(lambda (node) (equal (car node) end))
                                          predecessors) 
                               (list (list end predecessor)))))
  
  (defun init-visited ()
    (setq visited nil))
  