Kac's1 question “Can one hear the shape of a drum?” is part of the scientific pop culture2. The technical side of the question concerns our ability to completely specify the geometry of a domain from the eigenvalues of its Laplacian. The question has been reinterpreted in the study of Schrödinger operators on metric graphs by Gutkin and Smilansky3 and restated in Algebraic Graphs Theory as “Which graphs are determined by their spectrum?” by van Dam and Haemers4. (Through this work, the spectrum of a matrix M, denoted by SM, is the set of its eigenvalues.) While we commonly employ different types of matrices to encode the structure of graphs, none has yet been shown to efficiently provide a complete graph invariant, i.e., a parameter that does not change under a permutation of the vertex labels. The spectrum of the adjacency matrix, for example, is a common invariant and easily seen to satisfy the “if” part of this statement; however, it is not a complete invariant, given the fact that co-spectral non-isomorphic graphs are abundant5,6 (see for instance Supplementary Information Section A). In the same spirit, physical scenarios have suggested various notions of refined spectra as a tool for distinguishing graphs, with partial degrees of success7,8,9. A common intersection for these approaches is Quantum Mechanics, arguably due to the popularization of quantum dynamics on graphs at the beginning of the last decade10.

It is interesting, not only from the historical point of view, to observe that the strong link between Physics and graphs is via the Ising model, perhaps the most studied model in Statistical Mechanics. Originally proposed in 192511 as a simplified description of the magnetic properties of materials, the Ising model has found a vast number of applications from Biology to Solid State Physics. Its great importance is emphasized by exact solutions and numerical techniques for the identification of phase transitions and critical phenomena12. The Ising model framework seems particularly suitable to observe differences between Classical and Quantum Mechanics in terms of spectral information, since the quantum case is directly obtained by adding an appropriate (transverse) magnetic field to the classical Hamiltonian.

In what follows, we map a graph into an Ising model and interpret its energy spectrum as a graph invariant, before and after the “switch” from Classical to Quantum Mechanics. We demonstrate with exhaustive numerical examples that the quantum spectrum is a stronger invariant and propose a general framework to define physically meaningful graph polynomials. Determining whether the quantum energy spectrum is a complete invariant remains an open problem. We perform experiments on a programmable annealer with superconducting flux technology13. Our purpose is to “hear the shape of an Ising model”, by generating statistics of low energy states as the outcome of a noisy evolution. The experiment is run disregarding whether or not the state of the device follows an adiabatic path along its instantaneous ground state, therefore against the prescription for successful annealing14. In other words, we are not only interested in the ground state but, unconventionally, in the full output of a noisy computation. We obtain data on non-isomorphic graphs that are distinguished by their quantum energy spectra but not by the classical ones.


Classical Cospectrality and Ising models

The Hamiltonian of the Ising model15 (or, equivalent, 2-state Potts model) on a graph G, with n vertices V(G) and edges E(G), is defined by the diagonal matrix

where, for each edge is a 2n × 2n matrix, with H(k) = σz if k = i, j and H(k) = I, otherwise. A(G) is the adjacency matrix with [A(G)]i,j = 1 if {i, j} E(G) and [A(G)]i,j = 0, otherwise. σz is the Pauli matrix in the z-th coordinate axis, I is the identity matrix and J is the strength of interaction. From now on, whenever the interaction strength is not expressly indicated as, e.g., in H(G), we implicitly set J = 1 for all edges. The partition function of the Ising model on G is

where β: = (kBT)−1 and v = eβJ − 1; kB is Boltzmann's constant, is the temperature. By the Fortuin-Kasteleyn16 combinatorial identity, Z(G, v) is an evaluation of the Tutte polynomial17,18, which is a fundamental invariant that determines many parameters including girth, chromatic number, etc. Remarkably, the Jones polynomial of a knot is contained in the Tutte polynomial19. Recall that, formally, G and G′ are isomorphic if they are the same graph up to a relabeling of the vertices. This is denoted by . It is not hard to find graphs with the same Tutte polynomial (T-equivalent) that are not isomorphic20,21: for example, all trees on the same number of vertices.

Observe that two graphs G and G′ have the same partition function if and only if they share the same spectrum of the Hamiltonian in Eq. (1) (i.e.). We say that G and G′ are co-Ising if . Since the Tutte polynomial is a generalization of the partition function, if two graphs are T-equivalent then they share the same energy spectrum and thus are co-Ising. Thus, we know the following:

Intuitively, we may attempt a refinement by adding a longitudinal field. The Hamiltonian of the Ising model on G with longitudinal field is defined by the diagonal matrix

where is a 2n × 2n matrix, with , HL(k) = σz if k = i and HL(k) = I otherwise. Physically hM can be interpreted as a constant external magnetic field applied to all vertices. Again, we set J = 1 and h = 1 unless they are explicitly indicated. We say that two graphs G and G′ are longitudinal field co-Ising if for all values of J and h. The following equation summarizes what we know about graphs with this property (see Supplementary Information Section A and B for examples):

From the diagonal matrices H(G) and M, we can define the energy and magnetization vectors as eσ(G) = H(G)σ and mσ = Mσ, where σ = 0, 2, …, 2n − 1 runs over the classical states of the Ising model on G, where 0 denotes the ground state. With the use of these vectors, the bivariate Ising polynomial is defined as22:

Notice that the spectrum can be obtained from Z(G; x, y) for all values of the constants J and h, since a change in these parameters is just a rescaling of the coefficients x and y. The Ising polynomial generalizes the partition function in Eq. (2) because Z(G, e, 1) = Z(G, e − 1), encodes the matching polynomial, is related to the van der Waerden polynomial and is contained in a more general polynomial introduced by Goldberg, Jerrum and Paterson23,24,25. The bivariate Ising polynomial in Eq. (6) can be intuitively generalized by working with any physical observable in addition to energy and magnetization. If we denote by the eigenvalues of a diagonal matrix (or observable) Λk, we can then define a multivariate polynomial

An example is given by the (permutationally invariant) spin-glass order parameter used by Hen and Young26.

Quantum Cospectrality

The invariants that we have so far considered belong to Classical Physics. We can now move into a quantum mechanical regime by adding a further field. The Hamiltonian of the quantum Ising model on G, as proposed by Lieb, Schultz and Mattis27 (see also28) is defined by the matrix

where is a transverse external magnetic field; here is a 2n × 2n matrix, with , HT(k) = σx if k = i and HT(k) = I otherwise. As in the longitudinal case, MT does not depend on G. Two graphs G and G′ are said to be quantum co-Ising if for all values of J, h and Δ. It follows from the definition that two graphs are quantum co-Ising if they are isomorphic. The quantum partition function is defined analogously to the classical one:

Two graphs are quantum co-Ising if and only if they have the same quantum partition function. The “if” part of this statement comes directly from the definition. For the “only if” part, observe that in the limit β → ∞, determines the lowest eigenvalue E0 with its multiplicity ν0. Similarly, in the same limit determines the value and multiplicity of the second smallest eigenvalue. The whole spectrum is obtained iteratively. The statement above and its proof are valid only for systems of finite size. It is a well-known fact that different Hamiltonians can have the same partition function in the thermodynamic limit.

We tested numerically the converse of this fact by computing the smallest eigenvalue for h = J = Δ = 1. We tested all graphs with n ≤ 9, all bipartite graphs with n ≤ 11, all vertex transitive graphs with n ≤ 15, all regular graphs with n ≤ 11 and all trees with n ≤ 14 (also considered in22). We failed to find a counterexample. Hence,

The transverse field Ising Hamiltonian is a sum of non-commuting terms and determining its full spectrum requires the diagonalization of a 2n × 2n matrix. We cannot generalize directly the quantum partition function to a generating Ising polynomial as done in the classical case – when eigenvalues are integers (for J = h = 1) – although we can use the well-known Suzuki-Trotter formalism to obtain a classical approximation29; the direct calculation of the eigenvalues is notoriously expensive, due to the size of the problem and prone to errors, making it difficult to numerically show the existence of non-isomorphic quantum co-Ising graphs. A reasonable first approximation for this task is to compute the absolute largest eigenvalue. That is what we have done in our tests. Taking into account such difficulties, finding non-isomorphic quantum co-Ising graphs is an open problem. Natural candidates are graphs for which isomorphism testing is known to be harder to solve (e.g., graphs for which the Weisfeiler-Lehman algorithm fails)30. Nevertheless, we emphasize that spectral information provided by Quantum Mechanics is more accurate than Classical Mechanics. It must be said that there are only a few precise (and in fact negative) statements about the physically inspired graph invariants which have been introduced recently (see7,8,9,26 and the references therein) and that purely numerical analysis does not guarantee sufficient generality.


Disregarding computational complexity aspects, we have highlighted that from the theoretical point of view one can hear the shape of certain quantum Ising models, while it is not possible for the classical analogue. We subsequently encode on the same physical system pairs of non-isomorphic graphs that are co-spectral, longitudinal field co-Ising (and consequently co-Ising), but not quantum co-Ising. Rather remarkably, our set up finds an experimental implementation in the optimization technique called quantum annealing14,31,32,33. In this technique, the system evolves adiabatically according to the following time-dependent Hamiltonian

where s = t/Ttot; t is a time parameter and Ttot is the total duration of the dynamics. At the beginning of the computation, the system is prepared in the ground state of the initial simple Hamiltonian HQA(G, J, h, Δ, 0) = ΔMT. On the basis of the adiabatic theorem34, adiabatic quantum annealing with general Hamiltonians has been shown to be a universal model of computation by Aharonov et al.35. In synthesis, the core idea is to evolve the system slowly enough towards a final ground state, which is the solution of a computational task. While the success of this paradigm depends on the ability of avoiding level crossings with ad hoc annealing schedules, Brooke et al.31 experimentally observed that tunneling can hasten convergence to the solution.

In the setting specified by Eq. (11), we are interested in measuring the observables e0, m0 and . In a realistic situation, temperature and environment will usually excite the system. While these effects are disruptive in the standard applications of quantum annealing, we regard such a non-ideal implementation as a way to generate the statistics of low energy states on which we measure the corresponding observables. For this purpose, we run experiments on a D-Wave Vesuvius programmable annealer. The hardware consists of 503 usable logical bits on an integrated circuit with superconducting flux qubits (see13 for details on the technology). Quantum effects on the chip are currently under investigation and there is evidence of quantum annealing on random spin glass problems36,37,38,39,40. The Hamiltonians that can be realized with the device are exactly of the type in Eq. (11), where s is a non-linear function of time. The most general form of the final Hamiltonian HL is given by an Ising model whose possible spin interactions are constrained by the chip architecture. A particular limitation of the hardware is that measurements can be performed only at the end of the evolution. Thus, the maximal information that we can extract is encoded in the multivariate polynomials of Eq. (7). On the other hand, the final state of the chip is a result of a dynamics also governed by the transversal field MT. In fact, our experiments attempt to identify the effects of MT in the final statistics after the measurement outcomes are filtered out using various type of multivariate polynomials.

We have tested the annealer on two pairs of non-isomorphic graphs G and G′ (G13 and , G27 and , in Supplementary Information Section B and C) such that SA(G) = SA(G′), and , i.e., with equal spectra of the adjacency matrix, equal classical spectra, even with a longitudinal field and different quantum spectra. To illustrate a possible (arbitrary) refinement as introduced by Eq. (7), we include an extra observable, Ω2, corresponding to the next-nearest neighbor interaction energy: . Notice that H(G) = Ω1/2. Figure 1 shows the statistics of measurement outcomes when the states are distinguished through the doublet of observables {energy, magnetization} on the pairs {G13, }, for J = h = 1/7 and J = h = 1. These are respectively the smallest and the largest values that can be reliably set on the hardware. The final states are organized according to the values of the two observables. As a consequence of the fact that the two graphs are co-Ising, the measured values of the pairs {energy, magnetization} are the same and cannot be used to distinguish the two graphs. Moreover, the shape of the two distributions is also the same up to statistical errors. The shape of this distribution is assumed to be a consequence of (noisy) open system quantum dynamics36,37 (see Supplementary Information Section D for a comparison between experimental and thermal statistics). This means that we are not able to identify differences in the final distributions that may arise due to the different quantum spectra, i.e. due to non-equivalent quantum evolution along the annealing schedule.

Figure 1
figure 1

The statistical distribution of measurement outcomes Nocc on the pairs obtained by averaging over 100 cycles for each of the 100 different embeddings considered (10000 programming cycles in total).

The horizontal red line corresponds to the median of the data while the edges of the blue boxes correspond to the 1st and 3rd quartile. Each red cross is an outlier measurement. The outcomes have been filtered after choosing the pair of classical observables {e0, m0}. Data showed in the left panels correspond to the choice J = h = 1/7. In the right panels J = h = 1, that is the maximum strength of the couplings allowed by the hardware. With the given choice of classical observables, the distribution of measurement outcomes is not able to distinguish the two graphs, nor at the classical, neither at the quantum level.

The graphs are indistinguishable by measuring energy and magnetization only. However, they become distinguishable in Figure 2 by measuring the triplet {energy, magnetization, Ω2}, as clearly visible in the statistics obtained with the chip. The pair {G27, } is not distinguished by the triplet on the experimental data, as showed in Figure 3. It should be possible, in principle, to classically distinguish these graphs with the introduction of additional observables. Similarly to what happens for the G13 pair, there are no noticeable differences in the shape of the final distributions that can detect differences in the quantum spectra.

Figure 2
figure 2

The statistical distribution of measurement outcomes Nocc on the pairs .

The outcomes have been now filtered after choosing a triplet of classical observables {e0, m0, Ω2}. Data showed in the left panels correspond to the choice J = h = 1/7. In the right panels J = h = 1. Using a third observable distinguishes the two graphs at the classical level.

Figure 3
figure 3

The statistical distribution of measurement outcomes Nocc for the pairs {G27, }.

J = h = 1/7 in the left panels. J = h = 1 in the right panels. Filtering the outcomes after choosing the triplet {e0, m0, Ω2} does not distinguishes the graphs at the classical level and the introduction of additional observables is needed. The shape of the two distributions is also the same, meaning that the two graphs are not distinguished at the quantum level either.


The interplay between combinatorics and the classical Ising model is well-established. We have introduced a general family of physically meaningful graph polynomials suggesting a hierarchy of graph invariants. We have demonstrated that the quantum Ising model is a finer sieve to distinguish graphs than its classical analogue by considering the quantum partition function as a graph invariant. We have tested experimentally its distinguishability power on a D-Wave programmable annealer, by taking graphs with different quantum spectra and the same classical Ising partition function. We used the hardware unconventionally to generate the statistics of low energy eigenvalues rather than focusing on the ground state. The data obtained can distinguish one pair of graphs when measuring with respect to a classical refinement of the partition function. We did not find any measurable difference in the statistics of measurement outcomes of the two pairs that can be related to non-equivalent quantum dynamics. Notice that the transverse field spectra are very similar (Fig. 9 in the Supplementary Material). Of course, differences expected in an ideal quantum system are possibly lost due to decoherence when approaching the classical regime at the end of the adiabatic evolution.

Going beyond the scope of this work, it would be interesting to compare the experimental data with numerical simulations of the corresponding open quantum spin system at finite temperature41. We propose two approaches to amplify the differences in the quantum spectra: (a) reduce substantially the annealing time; (b) perform measurements when the transverse field is on. Both approaches require a modification of the current control of the hardware. Another interesting goal is to define other efficient observables, such as Ω2, that would amplify the possible differences in the measurement statistics. From the theoretical point of view a natural open question is whether the transverse field alone is sufficient to define a complete spectral graph invariant.


Experimental data collection

In order to collect enough statistics for averaging over biases and systematic errors, we have considered 100 embeddings in the chip for each graph. To average over precision errors when setting the intended couplings on the machine, we have run 100 programming cycles for each embedding. For each cycle, we have performed 1000 measurements. All the experiments have been performed choosing the shortest annealing time allowed by the hardware (Ttot = 20 μs) in order to minimize the effects of thermal excitations.