code: void advance(SimpleDependencyPath path) {
          if (path.length() >= maxPathLength)
              return;
  
          // Get the last node and last relation to decide how to expand.
          DependencyRelation lastRelation = path.lastRelation();
          DependencyTreeNode last = path.last(); 
          
          // Expand all of the possible relations from the last node, creating a
          // new path for each, except if the relation is the one that generated
          // this path.
          for (DependencyRelation rel : last.neighbors()) {
              // Skip re-adding the current relation
              if (lastRelation.equals(rel) || !acceptor.accept(rel))
                  continue;
              SimpleDependencyPath extended = path.extend(rel);
              frontier.offer(extended);
          }
      }
docs: Extends the path in its growth direction and adds to the frontier those
  relations that are shorter than the maximum path length and that are
  accepted by the {@code DependencyRelationAcceptor} used by this instance.