当前位置: 首页>>代码示例>>Java>>正文


Java ClusterSet类代码示例

本文整理汇总了Java中edu.uci.ics.jung.algorithms.cluster.ClusterSet的典型用法代码示例。如果您正苦于以下问题:Java ClusterSet类的具体用法?Java ClusterSet怎么用?Java ClusterSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClusterSet类属于edu.uci.ics.jung.algorithms.cluster包,在下文中一共展示了ClusterSet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processInput

import edu.uci.ics.jung.algorithms.cluster.ClusterSet; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void processInput(ConQATGraph graph) throws ConQATException {
	ClusterSet clusters = obtainGraphClusterer().extract(graph.getGraph());
	ConQATGraphUtils.collapseHierarchy(graph);

	for (int i = 0; i < clusters.size(); i++) {
		Set<?> cluster = clusters.getCluster(i);
		ConQATGraphInnerNode clusterNode = graph.createChildNode("Cluster "
				+ i, "Cluster " + i);
		for (Object o : cluster) {
			ConQATVertex v = (ConQATVertex) o;
			if (v.getParent() != graph) {
				getLogger().warn(
						"Node " + v.getId()
								+ " is in more than one cluster. "
								+ "Using only first cluster!");
			} else {
				v.relocate(clusterNode);
			}
		}
	}
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:24,代码来源:ClustererBase.java

示例2: 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);
		}
	}

}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:40,代码来源:ClusteringDemo.java

示例3: isConnected

import edu.uci.ics.jung.algorithms.cluster.ClusterSet; //导入依赖的package包/类
/**
 * Checks to see whether the graph is connected.
 * @param g the graph
 * @return Return true if yes, false if no
 */
public static boolean isConnected(Graph g) {
	WeakComponentClusterer wc = new WeakComponentClusterer();
	ClusterSet cs = wc.extract(g);
	return cs.size() == 1;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:11,代码来源:GraphProperties.java


注:本文中的edu.uci.ics.jung.algorithms.cluster.ClusterSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。