From a (not positive definite) Gram matrix to a (Kac-Moody) Cartan matrix Suppose I am given a symmetric matrix $G_{ij}$ with $G_{ii} = 2$. Can I always find an invertible integer matrix $S$ such that $(S^T G S)_{ii}=2$ and $(S^T G S)_{ij} \leq 0$ for $i \neq j$? Is there a practical algorithm to do so?
If you'd like a particular challenge, I'd like to know the answer for
$$G = \begin{pmatrix}
2 & -4 & 3 \\
-4 & 2 & -2 \\
3 & -2 & 2 \\
\end{pmatrix}.$$

There is an algorithm, based on a 1907 article of Hurwitz I mention sometimes, based in turn on the tree of Markov numbers. 
We begin with a ternary quadratic form $\langle 1,1,1,r,s,t \rangle.$ The (Lehman) discriminant of this is 
$$ 4 + rst - r^2 - s^2 - t^2.  $$ We would like to know whether we can find replacement values of $r,s,t$ so that all are nonpositive. Note first that this means the maximum discriminant we can allow is $4;$ anything bigger and we are out of luck as far as getting nonpositive off-diagonal coefficients.
Next note that we can always negate two $(rst)$ coefficients at a time. We can also permute $rst$ as we like. 
What we actually do is an operation on the $(r,s,t)$ triples. Suppose that $r$ has opposite sign to $st,$ so that $|st-r| < |r|.$ If $r$ is the largest entry (in absolute value) for which this is true, we replace $r$ by $st-r$ and keep the same discriminant. Give me a few minutes to fiddle with matrices and find out what $3$ by $3$ matrix, of the type that David calls $S,$ that corresponds to this Hurwitz flip. Hurwitz gave no name to the operation; the high schoolers on MSE call it Vieta jumping.  Well; in order to have $rst$ negative, or nonpositive, we must have their absolute values fairly small. 
Later: the jump specified above goes with the matrix product
$$ 
\left(
\begin{array}{rrr}
      1  &    0 &     0 \\ 
     0  &    1   &   0 \\ 
     s    &  0  &    -1
\end{array}
\right) 
\left(
\begin{array}{rrr}
      2  &    t &     s \\ 
     t  &    2   &   r \\ 
     s    &  r  &    2
\end{array}
\right)
\left(
\begin{array}{rrr}
      1  &    0 &     s \\ 
     0  &    1   &   0 \\ 
     0    &  0  &    -1
\end{array}
\right) =
\left(
\begin{array}{rrr}
      2  &    t &     s \\ 
     t  &    2   &   st-r \\ 
     s    &  st-r  &    2
\end{array}
\right)
$$
Here is another, which could be found from the first with some permutations on both sides.
$$ 
\left(
\begin{array}{rrr}
      -1  &    0 &     s \\ 
     0  &    1   &   0 \\ 
     0    &  0  &    1
\end{array}
\right) 
\left(
\begin{array}{rrr}
      2  &    t &     s \\ 
     t  &    2   &   r \\ 
     s    &  r  &    2
\end{array}
\right)
\left(
\begin{array}{rrr}
      -1  &    0 &     0 \\ 
     0  &    1   &   0 \\ 
     s    &  0  &    1
\end{array}
\right) =
\left(
\begin{array}{rrr}
      2  &   rs- t &     s \\ 
     rs-t  &    2   &   r \\ 
     s    &  r  &    2
\end{array}
\right)
$$
Third:
$$ 
\left(
\begin{array}{rrr}
      1  &    0 &     0 \\ 
     0  &    1   &   0 \\ 
     0    &  r  &    -1
\end{array}
\right) 
\left(
\begin{array}{rrr}
      2  &    t &     s \\ 
     t  &    2   &   r \\ 
     s    &  r  &    2
\end{array}
\right)
\left(
\begin{array}{rrr}
      1  &    0 &     0 \\ 
     0  &    1   &   r \\ 
     0    &  0  &    -1
\end{array}
\right) =
\left(
\begin{array}{rrr}
      2  &    t &     rt-s \\ 
     t  &    2   &   r \\ 
     rt-s    &  r  &    2
\end{array}
\right)
$$
