fix a bunch of edgecases with random weighted edges
while working on https://github.com/ssbc/ssb-lists I started to discover some problems with this module, this PR doesn't fix all of them yet, but improves quite a few. (enough that it enables https://github.com/ssbc/layered-graph/pull/4 )
should merge: but also we need to fix the problem cases too.
to enable breaking tests, uncomment: https://github.com/dominictarr/dynamic-dijkstra/pull/2/files#diff-308c6656543cf1bd4a4283cab81226e4R54
cc @mmckegg @arj03 @christianbundy
Its quite hard to review a patch like this. There is so much condensed information in the module already. Probably needs to document the null thing in the README. One thing that comes to mind is that it seems that you have a simple but slow implementation, and then an optimized version. Would it make sense to throw random graphs at both implementations and use the simple to test the optimized? To be honest I havn't read this module yet, so it might already have been covered.
that is actually how this works, but the simple-slow-correct implementation is just these lines: https://github.com/dominictarr/dynamic-dijkstra/blob/master/index.js#L37-L62
there are some simple hand written tests (enough to be sure that part is correct) then randomly generated tests, where dynamic updates are checked against the simple-correct-slow version.
yeah, so that aspect of it isn't very obvious, as has recently been brought to my attention.