sort method
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();
}