本文整理汇总了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;未经允许,请勿转载。 |
请发表评论