  We introduce the notion of orbit equivalence of directed graphs, following
Matsumoto's notion of continuous orbit equivalence for topological Markov
shifts. We show that two graphs in which every cycle has an exit are orbit
equivalent if and only if there is a diagonal-preserving isomorphism between
their $C^*$-algebras. We show that it is necessary to assume that every cycle
has an exit for the forward implication, but that the reverse implication holds
for arbitrary graphs. As part of our analysis of arbitrary graphs $E$ we
construct a groupoid $\mathcal{G}_{(C^*(E),\mathcal{D}(E))}$ from the graph
algebra $C^*(E)$ and its diagonal subalgebra $\mathcal{D}(E)$ which generalises
Renault's Weyl groupoid construction applied to $(C^*(E),\mathcal{D}(E))$. We
show that $\mathcal{G}_{(C^*(E),\mathcal{D}(E))}$ recovers the graph groupoid
$\mathcal{G}_E$ without the assumption that every cycle in $E$ has an exit,
which is required to apply Renault's results to $(C^*(E),\mathcal{D}(E))$. We
finish with applications of our results to out-splittings of graphs and to
amplified graphs.
