The problem is in the line
weights.resize(nrVertices+1);
in readData()
. This sets up a vector with nrVertices+1
elements of value 0. Later on, you append the actual values you want to this vector using weights.push_back(INT_MAX);
.
In the actual Dijkstra algorithm, all interesting weights
are thus 0, instead of the INT_MAX
you want.
Replace the line with
weights.resize(1);
(just to make sure that the index 1 really refers to the first element - you seem to use 1 as the first index instead of 0), and it might work.