def order_vertices(self):
ordered = False<EOL>while ordered == False:<EOL><INDENT>for i in range(len(self.vertices)):<EOL><INDENT>ordered = True<EOL>for parent in self.vertices[i].parents:<EOL><INDENT>if parent>i:<EOL><INDENT>ordered = False<EOL>self.swap_vertices(i, parent)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Order vertices in the graph such that parents always have a lower index than children.