We are considering the following problem:


Given an integer $n$ and a sequence of integers $r\_i,\ 1\le i\le n$, with $0\le r\_i\le n-1$ does there exists a symmetric matrix $A$ such that the diagonal elements of $A$ are $0$'s, the off-diagonal elements are only $-1$ and $1$ and for each $i$ there are exactly $r\_i$ $1$'s on the $i$-th row of $A$? How do we construct such a matrix? How do we construct all such matrices (up to some equivalence relation).


For example, if $n$ is even and half of $r\_i$ are equal to $n$, the other half to $n-1$. How do we construct such matrices? What about the case when $\{r\_i\}\_{i=1}^n$ is a constant sequence? When such a matrix exists?


The problem is related to the existence of certain codes with given distances between the codewords.



On the existence of symmetric matrices with prescribed number of 1's on each row
Replace each $-1$ with $0$. Then the matrix you look for is the adjacency matrix of a graph with a given degree sequence $r\_1, r\_2, \dots$. Reconstruction of such a graph (and its adjacency matrix) is known as the *graph realization* problem. E.g., see [Wikipedia](https://en.wikipedia.org/wiki/Graph_realization_problem) or [this webpage](https://piperfw.github.io/degreeSequences/) for additional details and solutions.


