Let $A\in\mathbb{R}^{N\times N}$ a matrix with entries $a_{ij} \ge 0$ and $\mathrm{det}(A)\neq 0$. I am interested in finding a closed matrix form operation such that $A$ becomes hollow.
In other words, if I want to obtain $$ \tilde{A}\in\mathbb{R}^{N\times N}\quad\text{such that}\quad \tilde{a}_{ij}=a_{ij}\;\forall (i\neq j)\quad\text{and}\quad\tilde{a}_{ii}=0 $$ with constant matrices $P$ and $Q$ such that $$ \tilde A=PAQ $$ is it possible?
I tried a simple example, when $N=2$ and with brute force I found an interesting correlation with a transformation matrix $Q$ (here $P=I$), but I do not know how (and if) it is generalizable to $N>2$: $$ A=\begin{pmatrix} a & b\\ c & d \end{pmatrix} $$ $$ \tilde{A}=\begin{pmatrix} 0 & b\\ c & 0 \end{pmatrix}=PAQ=IAQ=AQ=A\cdot\frac{1}{\det{A}}\begin{pmatrix} -bc & bd\\ ac & -bc \end{pmatrix} $$
EDIT From the comments, it has been pointed out that what I seek is not possible, meaning $P$ and $Q$ do not exist. Is there a way to prove this?
If I understand the question, you would like to have $$P\begin{bmatrix}1&1\\1&1\end{bmatrix}Q=\begin{bmatrix}0&1\\1&0\end{bmatrix}$$ This is not possible, since the left side has determinant $0$, and the right side has determinant $-1$.
With $N>2$, the story is the same using a matrix of all $1$s, which we can denote $\mathbf{1}$. In that case, you want $$P\mathbf{1}Q=\mathbf{1}-I$$ The left side has determinant $0$. As for the right side, note that $$(\mathbf{1}-I)\left(\frac{1}{N-1}\mathbf{1}-I\right)=\frac{N}{N-1}\mathbf{1}-\mathbf{1}-\frac{1}{N-1}\mathbf{1}+I=I$$ so the right side is invertible, and has nonzero determinant.
The question now stipulates that $\det A$ is nonzero. Consider a sequence $\{A_n\}$ of invertible matrices converging to $\mathbf{1}$. Then assuming such $P,Q$ exist: $$ \begin{align} PA_nQ&=A_n-\operatorname{diag}(A_n)\\ \lim_{n\to\infty}\left(PA_nQ\right)&=\lim_{n\to\infty}\left(A_n-\operatorname{diag}(A_n)\right)\\ P\left(\lim_{n\to\infty}A_n\right)Q&=\lim_{n\to\infty}\left(A_n\right)-\operatorname{diag}\left(\lim_{n\to\infty}\left(A_n\right)\right)\\ P\mathbf{1}Q&=\mathbf{1}-I \end{align} $$ which we have shown is impossible. So unless you further refine "in general" to exclude invertible matrices converging to $\mathbf{1}$, this can't be done.
Perhaps you are interested in a different question than what is posted: