def find_parents(self):
for i in range(len(self.vertices)):<EOL><INDENT>self.vertices[i].parents = []<EOL><DEDENT>for i in range(len(self.vertices)):<EOL><INDENT>for child in self.vertices[i].children:<EOL><INDENT>if i not in self.vertices[child].parents:<EOL><INDENT>self.vertices[child].parents.append(i)<EOL><DEDENT><DEDENT><DEDENT>
Take a tree and set the parents according to the children

        Takes a tree structure which lists the children of each vertex
        and computes the parents for each vertex and places them in.