Measurement incompatibility is the most basic resource that distinguishes quantum from classical physics. Contextuality is the critical resource behind the power of some models of quantum computation and is also a necessary ingredient for many applications in quantum information. A fundamental problem is thus identifying when incompatibility produces contextuality. Here, we show that, given a structure of incompatibility characterized by a graph in which nonadjacent vertices represent incompatible ideal measurements, the necessary and sufficient condition for the existence of a quantum realization producing contextuality is that this graph contains induced cycles of size larger than three.Incompatibility versus contextuality. Measurement incompatibility is arguably the most basic resource that distinguishes quantum and classical physics. Incompatibility is ubiquitous in protocols with a quantum-over-classical advantage and has been proven to be necessary for no-cloning [1] and nonlocality [2][3][4]. On the other hand, contextuality (a concept resulting from the Kochen-Specker theorem [5][6][7], but here used in the exact sense used in Refs. [8][9][10][11][12][13]) is the critical resource behind the quantum advantage of some models of quantum computation [14-21] and a necessary ingredient for many quantum protocols (e.g., device-independent quantum key distribution [22,23], quantum advantage in zeroerror classical communication [24], and some cryptographic protocols [25]). Therefore, a fundamental question is what is the relation between incompatibility and contextuality. This is the problem we address in this Rapid CommunicationThe definition of measurement incompatibility is independent of any physical theory. Two measurements, A, with outcome set {a x } x∈X , and B, with outcome set {b y } y∈Y , are incompatible (or not jointly measurable) if there is no measurement C with outcome set {c x,y } x∈X,y∈Y such that, for all initial states ρ, the probability P (a x |ρ) = y∈Y P (c x,y |ρ), for all outcomes a x , and the probability P (b y |ρ) = x∈X P (c x,y |ρ), for all outcomes b y . If such a C exists, then A and b are compatible (or jointly measurable). In other words, two measurements A and B are incompatible if there does not exist a measurement C such that both A and B are coarse grainings of C.A measurement scenario is characterized by a set M of measurements, their respective outcomes, and the subsets of M that are compatible. The relations of compatibility between the measurements in a scenario are usually represented by a hypergraph in which each vertex represents a measurement and vertices in the same hyperedge are mutually compatible (see, e.g., ).In general, contextuality indicates that the outcome statistics of an experiment involving several contexts (i.e., sets of compatible measurements) cannot be explained assuming that the outcomes reveal preexisting values that are independent of the context. However, there are several definitions of con- * adan@us.es textuality in the literature. The one for whi...