本文整理汇总了Java中org.gephi.dynamic.api.DynamicController类的典型用法代码示例。如果您正苦于以下问题:Java DynamicController类的具体用法?Java DynamicController怎么用?Java DynamicController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DynamicController类属于org.gephi.dynamic.api包,在下文中一共展示了DynamicController类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateClusteringCoefficient
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing calculateClusteringCoefficient() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
ClusteringCoefficient clusteringCoefficient = new ClusteringCoefficient();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating average clustering coefficient...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
clusteringCoefficient.execute(graphModel, am);
double sum = 0.0;
for (Node node : subGraph.getNodes()) {
sum += (double) node.getAttributes().getValue(ClusteringCoefficient.CLUSTERING_COEFF);
}
Double avg = sum / subGraph.getNodeCount();
clusteringCoefficientAverages.add(avg);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
示例2: calculateUndirectedDegree
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing calculateUndirectedDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int degreeSum = 0;
for (Node node : subGraph.getNodes()) {
degreeSum += (int) node.getAttributes().getValue(Degree.DEGREE);
}
Double avgDegree = (double) degreeSum / subGraph.getNodeCount();
degreeAverages.add(avgDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
示例3: calculateInDegree
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing calculateInDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for In-Degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int inDegreeSum = 0;
for (Node node : subGraph.getNodes()) {
inDegreeSum += (int) node.getAttributes().getValue(Degree.INDEGREE);
}
Double avgInDegree = (double) inDegreeSum / subGraph.getNodeCount();
inDegreeAverages.add(avgInDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
示例4: calculateOutDegree
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing calculateOutDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for Out-degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int outDegreeSum = 0;
for (Node node : subGraph.getNodes()) {
outDegreeSum += (int) node.getAttributes().getValue(Degree.OUTDEGREE);
}
Double avgOutDegree = (double) outDegreeSum / subGraph.getNodeCount();
outDegreeAverages.add(avgOutDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
示例5: saveNetworkSize
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing saveNetworkSize() {
Stopwatch stopwatch = Stopwatch.createStarted();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
List<Double> networkSize = new ArrayList<>();
Log.info(LogCategory.GEXF, "Saving network size...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.5;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
networkSize.add((double) subGraph.getNodeCount());
}
saveCsv(networkSize, new File("reports/" + getHostName() + "/networkSize.csv"));
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
示例6: setGraphModel
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
@Override
public void setGraphModel(GraphModel graphModel) {
this.graphModel = graphModel;
Workspace workspace = graphModel.getWorkspace();
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
if (dynamicController != null && workspace != null) {
dynamicModel = dynamicController.getModel(workspace);
}
// Trick: reset here to take the profile of the graph in account for default values
resetPropertiesValues();
}
示例7: calculateDynamicCentralities
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing calculateDynamicCentralities() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
GraphDistance graphDistance = new GraphDistance();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating average centralities...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 1;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
graphDistance.execute(graphModel, am);
double betweennessSum = 0.0;
double closenessSum = 0.0;
double eccentricitySum = 0.0;
for (Node node : subGraph.getNodes()) {
betweennessSum += (double) node.getAttributes().getValue(GraphDistance.BETWEENNESS);
closenessSum += (double) node.getAttributes().getValue(GraphDistance.CLOSENESS);
eccentricitySum += (double) node.getAttributes().getValue(GraphDistance.ECCENTRICITY);
}
Double averageBetweenness = betweennessSum / subGraph.getNodeCount();
Double averageCloseness = closenessSum / subGraph.getNodeCount();
Double averageEccentricity = eccentricitySum / subGraph.getNodeCount();
betweennessAverages.add(averageBetweenness);
closenessAverages.add(averageCloseness);
eccentricityAverages.add(averageEccentricity);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
示例8: printNetworkSize
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing printNetworkSize() {
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
System.out.println("Network size");
System.out.println("--------------------");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
System.out.println((int)i++ + ";" + subGraph.getNodeCount());
}
return this;
}
示例9: averageTopicDiameter
import org.gephi.dynamic.api.DynamicController; //导入依赖的package包/类
public GephiProcessing averageTopicDiameter(Set<String> topics) {
Stopwatch stopwatch = Stopwatch.createStarted();
final AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
final FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
final DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
final int topicSize = topics.size();
for (double i = 0.0; i < reportingIntervalCount; i++) {
Log.info(LogCategory.GEXF, "Calculating topic diameter for interval " + i + "...");
double diameter = 0;
double high = i + 1;
Graph graph = dynamicGraph.getSnapshotGraph(i, high);
// Log.debug(LogCategory.GEXF, "Node count: " + graph.getNodeCount());
// Log.debug(LogCategory.GEXF, "Edge count: " + graph.getEdgeCount());
for (String topic : topics) {
AttributeEqualBuilder.EqualStringFilter nodeFilter =
new AttributeEqualBuilder
.EqualStringFilter(am.getNodeTable().getColumn(NodeAttributes.TOPICS));
AttributeEqualBuilder.EqualStringFilter edgeFilter =
new AttributeEqualBuilder
.EqualStringFilter(am.getNodeTable().getColumn(EdgeAttributes.TOPICS));
final String pattern = ".*" + topic + ".*";
nodeFilter.init(graph);
edgeFilter.init(graph);
nodeFilter.setUseRegex(true);
edgeFilter.setUseRegex(true);
nodeFilter.setPattern(pattern);
edgeFilter.setPattern(pattern);
nodeFilter.evaluate(graph, graph);
nodeFilter.finish();
edgeFilter.evaluate(graph, graph);
edgeFilter.finish();
Query nodeQuery = filterController.createQuery(nodeFilter);
Query edgeQuery = filterController.createQuery(edgeFilter);
filterController.setSubQuery(nodeQuery, edgeQuery);
GraphView view = filterController.filter(edgeQuery);
graphModel.setVisibleView(view);
HierarchicalGraph subGraph = graphModel.getHierarchicalGraphVisible();
// Log.debug(LogCategory.GEXF, "Topic graph " + topic + " node count: " + subGraph.getNodeCount());
// Log.debug(LogCategory.GEXF, "Topic graph " + topic + " edge count: " + subGraph.getEdgeCount());
GraphDistance graphDistance = new GraphDistance();
graphDistance.execute(subGraph, am);
diameter += graphDistance.getDiameter();
}
double averageDiameter = diameter / topicSize;
// averageDiameter = (averageDiameter * 100.0) / 100.0;
topicDiameterAverages.add(averageDiameter);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}