I have some troubles implementing Dijkstra algorithm in Java.
I use this (first) pseudocode: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
Line 15 you need to get the vertex with the lowest distance.
But how can I save the distance with the according distance.
Note: vertex is defined as an Integer.
My solutions that didn't work properly:
- Map with K = vertex, V = distance, Problem: long searching to get min dist
- SortedMap with K = distance, V = vertex, Problem: almost every distance is defined as Integer.MAX_VALUE
So I am looking for a fast way to save a vertex to a distance and it should be easy to get the vertex with min dist.