B<----->A<-----------C
| ^ /
v | /
D------>E /
^ | /
| | /
| | /
F | /
\ | /
\ | /
\ | /
v
G
A graph consists of a set of nodes N and a set of edges E.
In the graph pictured above, N={A, B, C, D, E, F, G} and
E={(A, B) (B, A) (B, D) (C, A) (C, G) (D, E) (E, A) (E, G) (F, D) (F, G)}.
There is no ordering of the list of nodes or the list of edges. Each edge has a source and a target, and so the edge from A to B is different from the edge from B to A, though it is possible that both exist, as shown.
Note that each node has a name (typically just one letter) and we will record its location (a posn), so we can later draw the graph on a Canvas. Use a string (not a symbol) for the name.
Use check-expect from testing.ss to test
your functions. You are not required to provide test cases for functions
that produce images.
find-edges that extracts from a list of
node the list of all edges in that graph.
draw-node that draws a node
at its location as a
small red circle with its letter label overlayed on top. The
image.ss teachpack contains functions to create circle and
text images and functions to overlay one image on top of another.
draw-edge that
consumes two nodes and draws an edge between the nodes
as a red line between the locations of its two endpoints.
draw-nodes that draws all nodes in
a list of nodes.
draw-edges that
draws all edges in a given list of draw-edges should
consume a list of nodes.)
draw-graph
that will draw the whole graph given a list of nodes.
Using web-based turnin, turn in a single file hw1.scm containing all code and documentation for this assignment. Your name and wpi login name should appear in a comment at the top of the file.