MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).

Now consider the [EDIT: improved, much nicer] matrix2 & -2 & 3 & -4 & 6 & -2 1 & 0 & -1 & -3 0 & -5 0 & 1 \\-2 & 5 & -9 & 9 & -11 & 6 & -3 & 0 & 3 & 7 & -5 \\ 3 & -7 & 9 & -9 & 9 & -9 & 7 & -4 & -4 & -5 & 2 \\-2 & 4 & -7 & 6 & -7 & 6 & -6 & 4 & 3 & 2 & 0 \\ 1 & -2 & 4 & -5 & 5 & -4 & 3 0 & -2 0 & -3 0 & -2 & 0 1 \\0 & 1 & -3 & 3 & -4 & 2 & 0 & -1 & 1 & 3 & -2 \\ 0 & -1 & 1 & -2 & 3 & 0 & -2 & 2 0 & 0 & -4 0 & 3 0 \\-1 & 0 & 0 & 1 & -2 & -1 & 2 0 & -1 & 0 & 3 & -2 \\-3 & 3 & -4 & 3 & -5 & 4 & -4 & 3 & 3 & 2 & 0 \\ 0 & -2 & 5 & -7 0 & 7 0 & -3 0 & -1 & 2 & -2 & -6 & 4 \\0 & 0 & -2 & 3 & -5 & 0 & 2 & -1 & 2 0 & 4 0 & -1\end{array}\right]  C^{-1} = \left[\begin{array}{rrrrrrrrrrr}-28 0 & 14 0 & 10 0 & -1 & -8 & 6 & 3 & -10 & -17 & 10 & -21 0 \\14 0 & -8 0 & -4 0 & 2 0 & 5 1 & -5 0 & -4 0 & 3 0 & 10 0 & -7 0 & 10 0 \\20 0 & -11 0 & -6 0 & 2 0 & 5 0 & -5 1 & -5 0 & 6 0 & 13 0 & -8 0 & 14 0 \\13 0 & -6 0 & -5 0 & 0 & 3 0 & -3 0 & -1 & 5 0 & 7 0 & -4 0 & 10 0 \\-26 0 & 15 0 & 7 0 & -4 0 & -8 0 & 7 0 & 7 0 & -7 1 & -18 0 & 12 0 & -18 0 \\20 & -13 & -5 & 4 & 7 0 & -5 0 & -6 0 & 5 0 & 15 0 & -11 0 & 13 \\ 13 0 & -11 0 & -1 & 6 & 7 & -6 & -7 & 1 & 13 & -12 & 7 0 \\-31 & 13 & 13 & 2 & -7 0 & 5 0 & 1 & -12 & -16 & 7 & -25 \\-38 & 20 & 13 & -3 0 & -11 0 & 8 0 & 6 1 & -13 0 & -23 0 & 14 0 & -28 0 \\-18 0 & 12 0 & 3 0 & -5 0 & -7 0 & 7 0 & 7 0 & -3 1 & -15 1 & 12 0 & -11 0 \\38 & -18 & -15 & 0 & 10 & -7 & -3 & 14 & 21 & -11 & 30\end{array}\right]. end{array}\right] $$with determinant -1. Now to explain the black magicwhere the example comes from. The pair of graphsX_AY_B^{-1} then acts like the C is above. [EDIT: The actual matrix C I found at random and first posted was not nearly so pretty, with a Frobenius norm nearly ten times the current example. But taking powers 0 to 10 of A times C gave a \mathbb Q-basis for the full space of conjugators, whose Smith normal form (as 11 vectors in \mathbb R^{121}) was all 1's down the diagonal, so in fact it was a \mathbb Z-basis. Performing an LLL reduction on this lattice basis then just gave a list of smaller-norm matrices, the third of which is the more illuminating X_AY_B^{-1}.C given above, of determinant -1. The other determinants from the reduced basis were all 0 and \pm 8.] Taking rational x and not restricting the determinant of X_A gives a space of possible rational matrices C of dimension 11, which are generically invertible; varying y gives the same space . [EDIT: as does multiplying on the left by powers (or in the more general case commutants) of A]. Since the spectrum of A has no repeated roots, this is also the dimension of the commutant of A, and every matrix conjugating A to B lies in this space. Starting with a rational basis, it is not hard to find an exact basis for the integer sublattice, and taking the determinant of a general point in the integer lattice gives an integer polynomial in 11 variables which takes the value 1 or -1 if and only if the matrices A and B are conjugate over Z. If there are repeated roots, you have to work a little harder; in general you have to consider the full space has dimension the sum of matrices that commute with the squares of the multiplicities, and is generated by multiplying on the left by a basis for the commutator space of A. A basis for the commutant can be produced (for a diagonalizable matrix) by first conjugating A to a direct sum of companion matrices for the irreducible factors of the characteristic polynomial, whose dimension is the sum and then one at a time, for each k-by-k block corresponding to a k-times repeated factor of degree m, replacing each of the squares k^2 blocks with powers 0 to m-1 of the multi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& 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{array}\right]. $$These are both the adjacency matrices of trees, and both have characteristic polynomial$$\lambda^{11}-10\lambda^9+34\lambda^7-47\lambda^5+25\lambda^3-4\lambda.$$Each tree has exactly two vertices of degree 3, separated by a path of length 1 in the case of A but length 2 in the case of B. In particular, the trees are not isomorphic. Now consider the matrix$$ C = \left[\begin{array}{rrrrrrrrrrr} 2 & -2 & 3 & -4 & 6 & -2 & 0 & -1 & -3 & -5 & 1 \\ -2 & 5 & -9 & 9 & -11 & 6 & -3 & 0 & 3 & 7 & -5 \\ 3 & -7 & 9 & -9 & 9 & -9 & 7 & -4 & -4 & -5 & 2 \\ -2 & 4 & -7 & 6 & -7 & 6 & -6 & 4 & 3 & 2 & 0 \\ 1 & -2 & 4 & -5 & 5 & -4 & 3 & -2 & -3 & -2 & 0 \\ 0 & 1 & -3 & 3 & -4 & 2 & 0 & -1 & 1 & 3 & -2 \\ 0 & -1 & 1 & -2 & 3 & 0 & -2 & 2 & 0 & -4 & 3 \\ -1 & 0 & 0 & 1 & -2 & -1 & 2 & -1 & 0 & 3 & -2 \\ -3 & 3 & -4 & 3 & -5 & 4 & -4 & 3 & 3 & 2 & 0 \\ 0 & -2 & 5 & -7 & 7 & -3 & -1 & 2 & -2 & -6 & 4 \\ 0 & 0 & -2 & 3 & -5 & 0 & 2 & -1 & 2 & 4 & -1 \end{array}\right] $$with inverse$$ C^{-1} = \left[\begin{array}{rrrrrrrrrrr} -28 & 14 & 10 & -1 & -8 & 6 & 3 & -10 & -17 & 10 & -21 \\ 14 & -8 & -4 & 2 & 5 & -5 & -4 & 3 & 10 & -7 & 10 \\ 20 & -11 & -6 & 2 & 5 & -5 & -5 & 6 & 13 & -8 & 14 \\ 13 & -6 & -5 & 0 & 3 & -3 & -1 & 5 & 7 & -4 & 10 \\ -26 & 15 & 7 & -4 & -8 & 7 & 7 & -7 & -18 & 12 & -18 \\ 20 & -13 & -5 & 4 & 7 & -5 & -6 & 5 & 15 & -11 & 13 \\ 13 & -11 & -1 & 6 & 7 & -6 & -7 & 1 & 13 & -12 & 7 \\ -31 & 13 & 13 & 2 & -7 & 5 & 1 & -12 & -16 & 7 & -25 \\ -38 & 20 & 13 & -3 & -11 & 8 & 6 & -13 & -23 & 14 & -28 \\ -18 & 12 & 3 & -5 & -7 & 7 & 7 & -3 & -15 & 12 & -11 \\ 38 & -18 & -15 & 0 & 10 & -7 & -3 & 14 & 21 & -11 & 30 \end{array}\right]. 
Since $C^{-1}AC = B$, the two trees (on 11 vertices) are non-isomorphic but have adjacency matrices that are conjugate over $\mathbb Z$.
Now to explain the black magic. The pair of graphs was constructed by a method, attributed to Schwenk, that I found in Doob's chapter of Topics in algebraic graph theory (edited by Beineke and Wilson). The first 9 rows and columns of $A$, in common with $B$, come from a particular tree on 9 vertices that has a pair of attachment points such that extending the tree in the same way from either point gives isomorphic spectra. Adding a single pendant vertex cannot work for this problem, as I found using Brouwer and van Eijl's trick, mentioned by Chris Godsil, of comparing the Smith normal forms of (very) small polynomials in $A$ and $B$, in this case $A+2I$ and $B+2I$. When a path of length two is added at either of the two special vertices, however, there doesn't seem to be any obstruction of this type.
I then set about trying to conjugate both $A$ and $B$, separately, to the companion matrix of their mutual characteristic polynomial, by looking for a random small integer vector $x$ for which the matrix $X_A = [ x\ Ax\ A^2x\ \ldots\ A^{10}x]$ has determinant $\pm 1$, and similarly $y$ giving $Y_B$. (The fact that I succeeded fairly easily may have something to do with the fact that $A+I$ is invertible over $\mathbb Z$.) The matrix $C$ is then just $X_AY_B^{-1}$.
Taking rational $x$ and not restricting the determinant of $X_A$ gives a space of possible rational matrices $C$ of dimension 11, which are generically invertible; varying $y$ gives the same space. Since the spectrum of $A$ has no repeated roots, this is also the dimension of the commutant of $A$, and every matrix conjugating $A$ to $B$ lies in this space. Starting with a rational basis, it is not hard to find an exact basis for the integer sublattice, and taking the determinant of a general point in the integer lattice gives an integer polynomial in 11 variables which takes the value $1$ or $-1$ if and only if the matrices $A$ and $B$ are conjugate over $Z$. If there are repeated roots, you have to work a little harder; in general you have to consider the space of matrices that commute with the direct sum of companion matrices for the irreducible factors of the characteristic polynomial, whose dimension is the sum of the squares of the multiplicities.