本文整理汇总了Java中edu.uci.ics.jung.algorithms.cluster.ClusterSet.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterSet.iterator方法的具体用法?Java ClusterSet.iterator怎么用?Java ClusterSet.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.algorithms.cluster.ClusterSet
的用法示例。
在下文中一共展示了ClusterSet.iterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clusterAndRecolor
import edu.uci.ics.jung.algorithms.cluster.ClusterSet; //导入方法依赖的package包/类
public void clusterAndRecolor(SubLayoutDecorator layout,
int numEdgesToRemove,
Color[] colors, boolean groupClusters) {
//Now cluster the vertices by removing the top 50 edges with highest betweenness
// if (numEdgesToRemove == 0) {
// colorCluster( g.getVertices(), colors[0] );
// } else {
Graph g = layout.getGraph();
layout.removeAllSubLayouts();
EdgeBetweennessClusterer clusterer =
new EdgeBetweennessClusterer(numEdgesToRemove);
ClusterSet clusterSet = clusterer.extract(g);
List edges = clusterer.getEdgesRemoved();
int i = 0;
//Set the colors of each node so that each cluster's vertices have the same color
for (Iterator cIt = clusterSet.iterator(); cIt.hasNext();) {
Set vertices = (Set) cIt.next();
Color c = colors[i % colors.length];
colorCluster(vertices, c);
if(groupClusters == true) {
groupCluster(layout, vertices);
}
i++;
}
for (Iterator it = g.getEdges().iterator(); it.hasNext();) {
Edge e = (Edge) it.next();
if (edges.contains(e)) {
e.setUserDatum(DEMOKEY, Color.LIGHT_GRAY, UserData.REMOVE);
} else {
e.setUserDatum(DEMOKEY, Color.BLACK, UserData.REMOVE);
}
}
}