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^{\ast }$-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^{\ast }(E),{\mathcal{D}}(E))}$from the graph algebra$C^{\ast }(E)$and its diagonal subalgebra${\mathcal{D}}(E)$which generalises Renault’s Weyl groupoid construction applied to$(C^{\ast }(E),{\mathcal{D}}(E))$. We show that${\mathcal{G}}_{(C^{\ast }(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^{\ast }(E),{\mathcal{D}}(E))$. We finish with applications of our results to out-splittings of graphs and to amplified graphs.