• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UndirectedGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gephi.graph.api.UndirectedGraph的典型用法代码示例。如果您正苦于以下问题:Java UndirectedGraph类的具体用法?Java UndirectedGraph怎么用?Java UndirectedGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UndirectedGraph类属于org.gephi.graph.api包,在下文中一共展示了UndirectedGraph类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: rebuildGraph

import org.gephi.graph.api.UndirectedGraph; //导入依赖的package包/类
private void rebuildGraph(UndirectedGraph graph, Cluster[] clusters, double[][] annFreq, double K) {
    graph.clearEdges();

    for (int i = 0; i < clusters.length; i++) {
        for (int j = i + 1; j < clusters.length; j++) {
            double cos = MatrixOp.getEuclideanCosine(annFreq[i], annFreq[j]);
            /*double weight = 1; 
             for (double k = cos; k <= 1.0; k+=0.01) {
             weight -= vonMisesFisherDistribution.getProbabilityDensityOverCosAforK(k, 0, annFreq[0].length);
             }
             weight+=Math.max(weight,0)*2;
             */
            double weight = Math.exp(K * cos) / Math.exp(K);

            float dist = (float) (weight * EDGE_SCALING);
            if (dist > 0.05) {
                graph.addEdge(nodes[i], nodes[j]);
                graph.getEdge(nodes[i], nodes[j]).setWeight(dist);
            }
        }
    }
    for (int i = 0; i < 1000 && layout.canAlgo(); i++) {
        layout.goAlgo();
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:26,代码来源:frmFDL.java


示例2: partition

import org.gephi.graph.api.UndirectedGraph; //导入依赖的package包/类
public Partition<Node> partition(Graph<MultimodalItem, SameClassLink> itemsGraph) {

		UndirectedGraph graph = getGraph(itemsGraph);
		
		System.out.println("Nodes: " + graph.getNodeCount());
		System.out.println("Edges: " + graph.getEdgeCount());

		AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
		
		// Run modularity algorithm - community detection
		Modularity modularity = new Modularity();
		modularity.setUseWeight(true);
		modularity.setResolution(1.);
		modularity.setRandom(true);
		modularity.execute(graphModel, attributeModel);
		
		AttributeColumn modColumn = attributeModel.getNodeTable().getColumn(Modularity.MODULARITY_CLASS);

		@SuppressWarnings("unchecked")
		Partition<Node> p = partitionController.buildPartition(modColumn, graph);
		
		return p;
	}
 
开发者ID:socialsensor,项目名称:social-event-detection,代码行数:24,代码来源:LouvainClustering.java


示例3: setGraph

import org.gephi.graph.api.UndirectedGraph; //导入依赖的package包/类
public void setGraph(UndirectedGraph graph) {
    this.graph = graph;
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:4,代码来源:GraphRenderer.java


示例4: getGraph

import org.gephi.graph.api.UndirectedGraph; //导入依赖的package包/类
private UndirectedGraph getGraph(Graph<MultimodalItem, SameClassLink> itemsGraph) {
   	UndirectedGraph graph = graphModel.getUndirectedGraph();
   	
	int v = 0;
   	Collection<MultimodalItem> vertices = itemsGraph.getVertices();
   	for(MultimodalItem vertex : vertices) {
   		if(!nodes.containsKey(vertex.id)) {
   			Node node = factory.newNode(vertex.id);
   			nodes.put(vertex.id, node);
   			graph.addNode(node);
   		}
   		if(++v%10000==0) {
   			System.out.println(v + " nodes inserted into graph");
   		}
   	}
   	
   	int e = 0;
   	long t1 = 0, t2 = 0;
   	Collection<SameClassLink> edges = itemsGraph.getEdges();
   	for(SameClassLink edge : edges) {
   		long t = System.currentTimeMillis();
   		Pair<MultimodalItem> endpoints = itemsGraph.getEndpoints(edge);
   		
   		MultimodalItem item1 = endpoints.getFirst();
   		MultimodalItem item2 = endpoints.getSecond();
   		t1 += (System.currentTimeMillis() - t);
   		
   		
   		Node n1 = nodes.get(item1.id);
   		Node n2 = nodes.get(item2.id);
   		
   		if(edge.weight == 1) {
   			t = System.currentTimeMillis();
   			graph.addEdge(factory.newEdge(n1, n2, edge.weight, false));
   			t2 += (System.currentTimeMillis() - t);
   		}
   		
   		if(++e%100000==0) {
   			System.out.println(e + " edges inserted into graph. Load:" + t1 + ", Insert:" + t2);
   		}
   	}
   	
   	return graph;
}
 
开发者ID:socialsensor,项目名称:social-event-detection,代码行数:45,代码来源:LouvainClustering.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NextFilter类代码示例发布时间:2022-05-23
下一篇:
Java IBatchBolt类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap