You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of the visited boolean array/set we could try to introduce a boolean flag in EdgeEntry and see if this is faster (if we avoid the visit.contains check + rely entirely on the map.get check)
Explanation: we don't need the "visited" BitSet at all. The map<node, EdgeEntry> makes sure only the best path will be extracted. This means a minor disadvantage: some more distances for already visited nodes are calculated. But we don't see this slowing down in my simple performance analysis (e.g. the simple dijkstra is even faster)!
A BitSet is problematic as it is not clear how large it should be at the beginning of an algorithm and in the worst case it will have the length with the number of nodes. If we should ever need the "visited" check again we should add an EdgeEntry.visited flag instead.
Activity
agouge commentedon Mar 20, 2013
My "naive" implementation of Dijkstra seems to be faster than the current GH implementation over several iterations.
karussell commentedon Mar 20, 2013
Cool, what is the difference from a bird's eye view :) ?
karussell commentedon Apr 8, 2013
Explanation: we don't need the "visited" BitSet at all. The map<node, EdgeEntry> makes sure only the best path will be extracted. This means a minor disadvantage: some more distances for already visited nodes are calculated. But we don't see this slowing down in my simple performance analysis (e.g. the simple dijkstra is even faster)!
A BitSet is problematic as it is not clear how large it should be at the beginning of an algorithm and in the worst case it will have the length with the number of nodes. If we should ever need the "visited" check again we should add an EdgeEntry.visited flag instead.
Fallback to the original profile (#26)
Merge of navigation repository (#2071)