for (int i = 0; i < numChildren; i++) {
LayoutEntity newNode = createSimpleNode(getNextID());
entities.add(newNode);
if (addNonTreeRels && entities.size() % 5 == 0) {
int index = (int) (Math.random() * entities.size());
LayoutRelationship rel = new SimpleRelationship((LayoutEntity) entities.get(index), newNode, false);
relationships.add(rel);
}
LayoutRelationship rel = new SimpleRelationship(currentParentNode, newNode, false);
relationships.add(rel);
createTreeGraphRecursive(newNode, minChildren, maxChildren, minLevel, maxLevel, level + 1, randomNumChildren, randomLevels, addNonTreeRels);
}
}