code: public static <T extends Traversable<T>> boolean preorder(
        final NodeVisitor<T> nodeVisitor, final EdgeVisitor<T> edgeVisitor, final T node) {
      if (nodeVisitor != null && nodeVisitor.visit(node)) {
        if (edgeVisitor != null) {
          for (final T child : node.getChildren()) {
            if (!(edgeVisitor.visit(node, child)
                && preorder(nodeVisitor, edgeVisitor, child))) {
              return false;
            }
          }
        } else {
          for (final T child : node.getChildren()) {
            if (!preorder(nodeVisitor, null, child)) {
              return false;
            }
          }
        }
      }
      return true;
    }
docs: Traverse the configuration (sub)tree in preorder, starting from the given node.
  FIXME: handle loopy graphs correctly!
  
  @param nodeVisitor node visitor. Can be null.
  @param edgeVisitor edge visitor. Can be null.
  @param node        current node of the configuration tree.
  @return true if all nodes has been walked, false if visitor stopped early.