A polymorphic type contains a type variable, allowing one definition to work with values of multiple concrete types. Graph nodes do not need a fixed element type, so the graph representation remains flexible. section 5.1.1
A polymorphic graph
An undirected, unweighted graph can use an adjacency list: type Graph a = [(a,a)]. The variable a represents the node type, while each tuple records a connection between two nodes. This suits a word-ladder graph, where each edge represents one step. section 5.1.1
The simple representation has practical limits: checking edges, gathering neighboring nodes, and inserting edges may require scanning the entire list. An adjacency map can provide faster indexing, represented here as DiGraph a = [(a,[a])]. section 5.1.1
