6.8

Assignment 21

home work!

Programming Language ISL+

Due Date Thurs 4/6 at 11:59pm

Possible Points 20

Purpose To design a complex function that processes graphs and begin to use accumulators.

Graded Exercises

Exercise 1 Design find-paths which finds all paths in the graph from one node to another. An example graph as well as informally written tests are below:
(define G1
 (make-graph '(A B C D E F G)
             (lambda (n)
               (cond [(symbol=? n 'A) '(B E)]
                     [(symbol=? n 'B) '(E F)]
                     [(symbol=? n 'C) '(D)]
                     [(symbol=? n 'D) '()]
                     [(symbol=? n 'E) '(C F A)]
                     [(symbol=? n 'F) '(D G)]
                     [(symbol=? n 'G) '()]))))
(find-paths G1 'C 'C) -> '((C)) ; src = dest
(find-paths G1 'C 'G) -> '() ; no paths from 'C to 'G
(find-paths G1 'A 'B) -> '((A B))
(find-paths G1 'E 'G) -> '((E F G)  (E A B F G))
(find-paths G1 'B 'G) -> '((B E F G)  (B F G))
(find-paths G1 'A 'G) -> '((A B E F G) (A B F G) (A E F G))

You may assume the symbols are in the graph.