docs: def __get_cycle(graph, ordering, parent_lookup):
      """Gets the main cycle of the dfs tree."""
      root_node = ordering[0]
      for i in range(2, len(ordering)):
          current_node = ordering[i]
          if graph.adjacent(current_node, root_node):
              path = []
              while current_node != root_node:
                  path.append(current_node)
                  current_node = parent_lookup[current_node]
              path.append(root_node)
              path.reverse()
              return path