I'm trying to create a program that from a starting coordinate finds the lowest cost path of traveling to all of the other coordinates in a matrix using Dijkstra's Algorithm. Any coordinate that has an infinite value is avoided when traversing.
I'm trying to create a program that from a starting coordinate finds the lowest cost path of traveling to all of the other coordinates in a matrix using Dijkstra's Algorithm. Any coordinate that has an infinite value is avoided when traversing.
You are confusing node and current_node:
x_check = node[0] + move[0]
y_check = node[1] + move[1]
should be
x_check = current_node[0] + move[0]
y_check = current_node[1] + move[1]
By the way, in Python, you are allowed to write
if 0 <= x_check <= N-1 and 0 <= y_check <= N-1:
which is much more readable !