A simple implementation of graphs using adjacency lists.
> module Graph( > Vertex, Edge, Graph, adjacent, vertices) > where > import Array
> type Vertex = Int > type Edge = (Vertex, Vertex) > type Graph = Array Vertex [Vertex] > > adjacent :: Graph -> Vertex -> [Vertex] > adjacent g v = g ! v > > vertices :: Graph -> [Vertex] > vertices g = indices g