Matrix as Graph - Graph / Matrix as Graph

https://algo.monster/problems/matrix_as_graph

awesome lesson

Agree with seriouscode, more like this would be really helpful.

Please where is the Coordinate class defined

the conditional check in the while loop only checks if neighborRow < numRows && neighborCol < numCols, therefore it’ll return neighbors outside the matrix as valid neighbor.

e.g. getting the neighbors of the top left node would return the non existent node to its left as valid!

This was nice.

@mod
How do you alter get_neighbors to get diagonal neighbors?

add the 4 indices for the diagonal nodes, e.g. top left is (r-1, c-1), bottom right is (r+1, c+1)