Dijkstra in Javascript for finding the fastest path between items in the store