This diagram represents the geographic relation of some cities in the Puget Sound region of Washington state. A line (possibly a crooked line) connecting two cities means you can reach one from the other without passing through any of the other cities.
Bremerton ------------- Seattle
| |
| |
| |
| |
Gig Harbor -------------Tacoma
| |
| |
| |
+------ Olympia ------+
Define a Scheme variable named puget-routes to encode
this diagram. Represent city names by (double-quoted) strings so we
can easily represent cities whose names have more than one word:
"Seattle", "Gig Harbor" etc. Represent the diagram as a list of
lists. The car of each list is the name of a city and the
cdr of each list is a list of all the cities that
can be reached from the first city.
(define puget-cities
'(("Bremerton" "Seattle" "Gig Harbor")
("Gig Harbor" "Bremerton" "Tacoma" "Olympia")
("Olympia" "Gig Harbor" "Tacoma")
("Tacoma" "Olympia" "Gig Harbor" "Seattle")
("Seattle" "Bremerton" "Tacoma")))