1. A computer-implemented method of determining an execution ordering, comprising: generating a directed graph based on a hierarchy comprising a plurality of pattern queries; determining a minimum spanning tree of the directed graph; and determining an execution order of the pattern queries based on the minimum spanning tree.