  We consider hereditary classes of graphs equipped with a total order. We
provide multiple equivalent characterisations of those classes which have
bounded twin-width. In particular, we prove a grid theorem for classes of
ordered graphs which have unbounded twin-width. From this we derive that the
model-checking problem for first-order logic is fixed-parameter tractable over
a hereditary class of ordered graphs if, and -- under common
complexity-theoretic assumptions -- only if the class has bounded twin-width.
For hereditary classes of ordered graphs, we show that bounded twin-width is
equivalent to the NIP property from model theory, as well as the smallness
condition from enumerative combinatorics. We prove the existence of a gap in
the growth of hereditary classes of ordered graphs. Furthermore, we provide a
grid theorem which applies to all monadically NIP classes of structures
(ordered or unordered), or equivalently, classes which do not transduce the
class of all finite graphs.
