Scheme Find all possible paths for an undirected graph
问题 I am having problem to print out all the possible paths. Currently I am only able to print out one path, and if (path-demo "J" "I"), the program will shown this error mcdr: expects argument of type <mutable-pair> ; given #f (define net '(("A" "B") ("B" "A" "C") ("C" "B" "D") ("D" "C" "E" "F") ("F" "I" "D") ("I" "F") ("E" "D" "J") ("J" "E" "G") ("G" "J" "H"))) (define (path-demo start finish) (for-each (lambda (x) (display x) (display " ")) (cons "Route:" (shortest-path start finish net))))