topological sort
noun1
Computer, Computing, Engineering, Graph theory, Mathematics, Natural sciences, Physical sciences, Science, Sciences An ordering of the vertices of a directed graph such that if an edge goes from vertex u to vertex v then u precedes v in the ordering.