Let M be an n×n-matrix with entries only 0 or 1. Let R be the same matrix as M but with all diagonal entries set to zero. Let U=(ui,j) be the matrix with 1 as an entry if R2=R∗R (the matrix product of R with itself) has a non-zero entry in the same position and let U have 0 in this entry if R2 has 0 as an entry in this position.
Let GM be the directed graph with n vertices and there is an arrow from i to j if and only if ui,j is 1.
My question is whether there is a quick method to obtain all 0-1 matrices with Sage for a given n and the associated graph GM.