Question: using dr racket... Redesign the find-path program as a single function Using your data definitions for Node and Graph-regardless of which one you chose, as
using dr racket...
Redesign the find-path program as a single function


Using your data definitions for Node and Graph-regardless of which one you chose, as long as you also designed neighbors-we can now formulate a signature and a purpose statement for find-path, the function that searches a path in a graph: ; Node Node Graph -[List-of Node] ; finds a path from origination to destination in G (define (find-path origination destination G) What this header leaves open is the exact shape of the result. It implies that the result is a list of nodes, but it does not say which nodes it contains. To appreciate this ambiguity and why it matters, let's study the examples from above. In ISL+, we can now formulate them like this: (find-path 'C 'D sample-graph) (find-path 'E 'D sample-graph) (find-path 'C G sample-graph) A Path is a [List-of Node]. interpretation The list of nodes specifies a sequence of immediate neighbors that leads from the first ; Node on the list to the last one. ; Node Node Graph [Maybe Path] ; finds a path from origination to destination in G ; if there is no path, the function produces #false (check-expect (find-path 'C 'D sample-graph) (check-member-of (find-path 'E 'D sample-graph) (check-expect (find-path C 'G sample-graph) (C D)) (EF D) '(E C D)) #false) (define (find-path origination destination G) #false)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
