public boolean hasAncestor(Set<String> variables){
  Queue<BNode> nodesToProcess=new LinkedList<BNode>();
  nodesToProcess.add(this);
  while (!nodesToProcess.isEmpty()) {
    BNode currentNode=nodesToProcess.poll();
    for (    BNode ancestorNode : currentNode.getInputNodes()) {
      if (variables.contains(ancestorNode.getId())) {
        return true;
      }
      if (!nodesToProcess.contains(ancestorNode)) {
        nodesToProcess.add(ancestorNode);
      }
    }
  }
  return false;
}

public boolean hasAncestor ( Set < String > variables ) { Queue < BNode > nodesToProcess = new LinkedList < BNode > ( ) ; nodesToProcess . add ( this ) ; while ( ! nodesToProcess . isEmpty ( ) ) { BNode currentNode = nodesToProcess . poll ( ) ; for ( BNode ancestorNode : currentNode . getInputNodes ( ) ) { if ( variables . contains ( ancestorNode . getId ( ) ) ) { return true ; } if ( ! nodesToProcess . contains ( ancestorNode ) ) { nodesToProcess . add ( ancestorNode ) ; } } } return false ; }
returns true if at least one of the variables given as argument is an ancestor of this node , and false otherwise
