Dijkstra's algorithm, java implementation in processing