isOutputNode method

bool isOutputNode(
  1. Node<T> target
)

Returns true if target is an output of this node.

Implementation

bool isOutputNode(Node<T> target) {
  if (this == target) return false;

  var graphWalker = GraphWalker<T>(
    stopMatcher: NodeEquals<T>(target.value),
  );

  return graphWalker.walkByNodes<bool>(
        [this],
        outputsProvider: (step, node) => node._outputs,
        process: (step) =>
            step.node == target ? GraphWalkingInstruction.result(true) : null,
      ) ??
      false;
}