Dijkstras shortest path algorithm implemented in C