sort method

  1. @override
List<T> sort(
  1. T root
)
override

Implementation

@override
List<T> sort(T root) {
  _order = <T>[];

  if (!visit(root)) {
    // if we detect cycles, go find them all
    findCycles(root);

    // revisit the tree, skipping nodes on any cycle.
    visit(root);
  }

  return _order.reversed.toList();
}