(define (find-route orig dest G) (local ((define (neighbours v G) (cond [(empty? G) (error 'neighbours (string-append (symbol->string v) " not in graph"))] [else (cond [(symbol=? v (first (first G))) (second (first G))] [else (neighbours v (rest G))])])) (define (find-route-helper orig dest seen still-to-visit G) (cond [(and (empty? still-to-visit) (empty? (neighbours orig G))) false] [(member dest seen) still-to-visit] [(empty? (neighbours orig G)) (find-route-helper (first still-to-visit) dest seen (second (rest still-to-visit)) G)] [else (find-route-helper (first (neighbours orig G)) dest (append (neighbours orig G) seen) (append (list (first seen) (rest (neighbours orig G))) (list still-to-visit)) G)]))) (find-route-helper orig dest (list orig) empty G)))