sideRoots method

List<Node<T>> sideRoots({
  1. int? maxDepth,
})

Return the list of side roots after this Node.

Implementation

List<Node<T>> sideRoots({int? maxDepth}) {
  var myRoots = roots();

  var outputs = outputsInDepth(maxDepth: maxDepth).toList(growable: false);

  var outputsRoots =
      outputs.expand((e) => e.roots()).toSet().toList(growable: false);

  var complement = myRoots.complement(outputsRoots, includeThis: false);
  complement.remove(this);

  return complement;
}