Inspired by this Mathematica.SE post Given two positive integers \$n, k\$ with \$n > k \ge 1\$, output a binary \$n\times n\$ matrix such that every row and column contains exactly \$k\$ 1s, and the leading diagonal is all zero. This is the adjacency matrix of a regular graph. You may output any ...