  We study locally closed transformation monoids which contain the automorphism
group of the random graph. We show that such a transformation monoid is locally
generated by the permutations in the monoid, or contains a constant operation,
or contains an operation that maps the random graph injectively to an induced
subgraph which is a clique or an independent set. As a corollary, our
techniques yield a new proof of Simon Thomas' classification of the five closed
supergroups of the automorphism group of the random graph; our proof uses
different Ramsey-theoretic tools than the one given by Thomas, and is perhaps
more straightforward. Since the monoids under consideration are endomorphism
monoids of relational structures definable in the random graph, we are able to
draw several model-theoretic corollaries: One consequence of our result is that
all structures with a first-order definition in the random graph are
model-complete. Moreover, we obtain a classification of these structures up to
existential interdefinability.
