Constructing equivalent matrices with rows and columns exchanged I am trying to construct all inequivalent $8\times 8$ matrices (or $n\times n$ if you wish) with elements 0 or 1. The operation that gives equivalent matrices is the simultaneous exchange of the i and j row AND the i and j column. eg. for $1\leftrightarrow2$
\begin{equation}
\left( \begin{array}{ccc}
0 & 0 & 0 \\
0 & 1 & 1 \\
1 & 0 & 0 \end{array} \right) \sim
\left( \begin{array}{ccc}
1 & 0 & 1 \\
0 & 0 & 0 \\
0 & 1 & 0 \end{array} \right)
\end{equation}
Eventually, I will also need to count how many equivalent matrices there are within each class but I think Polya's counting theorem can do that. For now I just need an algoritmic way of constructing one matrix in each inequivalence class. Any ideas?
 A: A square $n\times n$ matrix over $\{0,1\}$ encodes a directed graph (loops and pairs of opposite pointing edges being allowed) on a set of vertices labelled $1,2\ldots,n$. Your equivalence then corresponds to interchanging the labels $i$ and $j$. The equivalence classes then correspond to isomorphism classes of such graphs on $n$ unlabelled vertices. I'm sure you will find more information if you study that problem.
A: I have made some progress towards answering this question. I am posting here in case anyone else is interested and also because as Marc said this construction might have some usefulness for graph problems.
Count the number of 1s in each row. Let $a_0$ be the number of rows with zero 1s, $a_1$ the number of rows with one 1 and so on up to $a_8$ which is the number of rows that have eight 1s. Obviously $\sum a_i=8$. The proposed parametrization that I have come to after trial and error is:
$$(a_1,\cdots, a_8; T, S)$$
where T is the trace of the matrix and S is $1$ if the matrix is symmetric and $0$ otherwise.
T runs from $0$ to $\sum_{i=1}^8 a_i=8-a_0$.
From my trials and errors it looks like that if two matrices are different in this parametrization then they belong to different equivalence classes, so to construct a representative in each class we just scan through the space of parameters as described above. 
As far as I can tell, this works. Nevertheless, I would be grateful if somebody could prove it or give a counterexample in case it doesn't...
