I have a 2d matrix of booleans and I want to solve some pathfinding problems using scipy. I would like to know how to convert below matrix in a csr_matrix or sparse matrix to transform it into a adjacency matrix to use in scipy.sparse.csgraph.
maze = np.array([
[1, 1, 0],
[0, 0, 1],
[0, 0, 1]])
sparseMatrix = ...
graph = csr_matrix(graph)
dist_matrix, predecessors = dijkstra(csgraph=graph, directed=False, indices=0, return_predecessors=True)