6.7

Assignment 19

home work!

Programming Language ISL+

Due Date Thurs 3/30 at 11:59pm

Possible Points 20

Purpose To design a more complex function that processes graphs.

Graded Exercises

Exercise 1 Design the function same-graph? that determines in two graphs are the same. The following tests should pass:
(check-expect  (same-graph? (make-graph '(a) (lambda (x) '()))
                            (make-graph '() (lambda (x) '())))
               #false)
 
(check-expect (same-graph? (make-graph '(a) (lambda (x) '()))
                           (make-graph '(a) (lambda (x) '())))
              #true)
 
(check-expect (same-graph? (make-graph '(b) (lambda (x) '()))
                           (make-graph '(a) (lambda (x) '())))
              #false)
 
(check-expect (same-graph? (make-graph '(a b) (lambda (x) '()))
                           (make-graph '(b a) (lambda (x) '())))
              #true)
 
(check-expect (same-graph? (make-graph '(a b)
                                       (lambda (x)
                                         (cond
                                           [(symbol=? x 'a) '(b)]
                                           [(symbol=? x 'b) '()])))
                           (make-graph '(a b)
                                       (lambda (x)
                                         (cond
                                           [(symbol=? x 'a) '(a)]
                                           [(symbol=? x 'b) '()]))))
              #false)
(check-expect (same-graph? (make-graph '(a b)
                                       (lambda (x)
                                         (cond
                                           [(symbol=? x 'a) '(b a)]
                                           [(symbol=? x 'b) '()])))
                           (make-graph '(b a)
                                       (lambda (x)
                                         (cond
                                           [(symbol=? x 'a) '(a b)]
                                           [(symbol=? x 'b) '()]))))
              #true)