For random systems subject to a constraint, the microcanonical ensemble requires the constraint to be met by every realisation ('hard constraint'), while the canonical ensemble requires the constraint to be met only on average ('soft constraint'). It is known that for random graphs subject to topological constraints breaking of ensemble equivalence may occur when the size of the graph tends to infinity, signalled by a non-vanishing specific relative entropy of the two ensembles. We investigate to what extent breaking of ensemble equivalence is manifested through the largest eigenvalue of the adjacency matrix of the graph. We consider two examples of constraints in the dense regime: (1) fix the degrees of the vertices (= the degree sequence); (2) fix the sum of the degrees of the vertices (= twice the number of edges). Example (1) imposes an extensive number of local constraints and is known to lead to breaking of ensemble equivalence. Example (2) imposes a single global constraint and is known to lead to ensemble equivalence. Our working hypothesis is that breaking of ensemble equivalence corresponds to a non-vanishing difference of the expected values of the largest eigenvalue under the two ensembles. We verify that, in the limit as the size of the graph tends to infinity, the difference between the expected values of the largest eigenvalue in the two ensembles does not vanish for (1) and vanishes for (2). A key tool in our analysis is a transfer method that uses relative entropy to determine whether probabilistic estimates can be carried over from the canonical ensemble to the microcanonical ensemble, and illustrates how breaking of ensemble equivalence may prevent this from being possible.