Dijkstra with two dimensional array