/**
* 阶段最大宽度
* @return
*/
public Integer breadth() {
Queue<GroupNode> queue = new LinkedList<>();
queue.offer(this);
int maxCount = 0;
int currentLevelSize;
while (!queue.isEmpty()) {
currentLevelSize = queue.size();
if (currentLevelSize > maxCount) {
maxCount = currentLevelSize;
}
for (int i = 0; i < currentLevelSize; i++) {
GroupNode node = queue.poll();
for (GroupNode child : node.childs) {
queue.offer(child);
}
}
}
return maxCount;
}
}
JGraphX is a Java Swing diagramming (graph visualisation) library licensed under the BSD license (see https://github.com/jgraph/jgraphx)
Unfortunately JGraphX is not available at Maven Central, and this project solves that.
Value added by jgraph-publish:
jar, javadoc, and sources are published to Maven Central
Gradle build (the code imports in IDEA automatically)