Given the adjacency matrix of a graph $G$ with at least one cycle, is there a known analytical method to create a submatrix of walkable paths.
Def. A walkable path is a matrix with no leaves.
Example: $A=\begin{pmatrix} 0&1&0&0 \\ 0&0&1&0 \\ 1&0&0&1 \\ 0&0&0&0 \end{pmatrix}$ has the following walkable subgraph $S=\begin{pmatrix} 0&1&0&0 \\ 0&0&1&0 \\ 1&0&0&0 \\ 0&0&0&0 \end{pmatrix}$ as it is impossible to "get stuck" and not be able to keep moving forward. - Walking onto a leaf would constitute "getting stuck"
An algorithmic approach could entail removing leaves until only cycles remain, I am interested in a direct analytical approach.
Thanks, Ben
I would like you to present to you a lame but working technique. You calculate $Q=A^n$, where $n$ is the size of the matrix. And then for every $i$-th zero row in $Q$, you set the $i$-th column in $A$ to zero.