job graph topological sort & priority