Make Data.Graph.Inductive.NodeMap handle slightly messy input without crashing
|Reported by:||jyasskin@…||Owned by:|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Revisions:|
Using the current version of Data.Graph.Inductive casually is unnecessarily difficult because if you insert a node that's already present in the graph, or try to insert an edge with an endpoint that's not already in the graph, the library crashes. For the raw graph operations that's somewhat reasonable since it wouldn't know what labels to use. NodeMap, on the other hand, has plenty of information, so this patch makes it safer in these cases.
I've also added the beginning of a test suite runnable with runhaskell Setup.hs test.