All adjacency matrices of size n
Tuples
Tuples[{0, 1}, {2, 2}]
TeXForm @ Grid[Partition[MatrixForm /@ %, 8]]
$\small\begin{array}{cccccccc} \left( \begin{array}{cc} 0 & 0 \\ 0 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 0 \\ 0 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 0 \\ 1 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 0 \\ 1 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 1 \\ 0 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 1 \\ 0 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 1 \\ 1 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 1 \\ 1 & 1 \\ \end{array} \right) \\ \left( \begin{array}{cc} 1 & 0 \\ 0 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 0 \\ 1 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 0 \\ 1 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 1 \\ 0 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 1 \\ 0 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 1 \\ 1 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 1 & 1 \\ 1 & 1 \\ \end{array} \right) \\ \end{array}$
Grid[Partition[#, 4], Dividers -> All] & @
(Labeled[AdjacencyGraph[#, DirectedEdges -> True,
VertexLabels -> "Name", ImageSize -> {120, 60},
VertexSize -> Tiny, VertexCoordinates -> {{1/3, 0}, {2/3, 0}}],
Pane[MatrixForm[#], ImageMargins -> 10], Top] & /@ Tuples[{0, 1}, {2, 2}], 4])
IntegerDigits
You can use PadLeft
with IntegerDigits
and Partition
the results as follows:
n = 2;
Partition[#, n] & /@ PadLeft[IntegerDigits[Range[0, 2^( n^2) - 1], 2]]
% == Tuples[{0, 1}, {n, n}]
True