How to create a connected 2D grid graph? I have a 2-dimensional array that represents a grid. The (numpy) array is as follows: