Stealing copyrighted code is unwise. Reimplemented dijkstra with more useful signature.