I have a 2-dimensional array that represents a grid. The (numpy) array is as follows:
dx_grid =[[ "A", "B", "C"],
[ "L", "M", "N"],
[ "X", "Y", "Z"]]
I want to convert that into the following:
I know that grid_2d_graph can connect 4 adjacent nodes. For example, it would connect node M to B, L, N and Y BUT NOT to A, C, X, Z. How would I create such a graph using networkx
in python?