graph
graph copied to clipboard
Fix potential panic on AdjacencyMap
Because the store could theoretically be updated without the use of the
main AddVertex
and AddEdge
APIs (which does some input validation),
calculating the AdjencyMap
could provoke an "assignment to entry in
nil map" panic if the store reported edges that were between unknown
vertices.
Since the edges are always between known vertices, it is an error to try and match a missing source vertex from the vertex set. If that happens, it is a data desynchronization error that we report to the user.
In order to test this pathological case, we needed to modify the test to use the store directly because the "front-facing" API would not allow us to add Edges on missing vertex.
fixes #102
Signed-off-by: davidovich [email protected]