class DFSTree {

public List<String> generateCombinations() {
      ArrayList<String> results = Lists.newArrayList();

      Collection<List<DFSTree>> permutations = Collections2.permutations(nodes);

      for (List<DFSTree> permutation : permutations) {
         results.add(label + "," + Joiner.on(',').join(permutation));
      }

      List<String> childrenLabels = Lists.newArrayList();
      for (DFSTree node : nodes) {
         if(!node.nodes.isEmpty()) {
            Collection<List<DFSTree>> childrenPermutation = Collections2.permutations(node.nodes);
            for (List<DFSTree> child : childrenPermutation) {
               childrenLabels.add(Joiner.on(',').join(child));
            }
         }
      }

      if(childrenLabels.isEmpty()) {
         return results;
      }
      List<String> listOfString = Lists.newArrayList();

      List<List<String>> lists = Lists.cartesianProduct(results, childrenLabels);

      Joiner j  =Joiner.on(",");
      for (List<String> list : lists) {
         listOfString.add(j.join(list));
      }

      return listOfString;
}

public  DFSTree(int label);

}