class Dag {

  public String print() throws DagConstructionException {
    detectCycles();
    for (DagNode node : findRootNodes()) {
      node.findMaxIndentionLevel(2);
    }
    String prob = UUID.randomUUID().toString();
    StringBuilder builder = new StringBuilder();
    for (DagNode node : findRootNodes()) {
      builder.append("\n").append(node.printBfs(prob, "1|", 2));
    }
    return builder.toString();
  }

}