本文整理汇总了Java中org.gephi.graph.api.GraphModel类的典型用法代码示例。如果您正苦于以下问题:Java GraphModel类的具体用法?Java GraphModel怎么用?Java GraphModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphModel类属于org.gephi.graph.api包,在下文中一共展示了GraphModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bResetColorsActionPerformed
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
/**
* Click on button "Reset Colors"
* @param evt ActionEvent
*/
private void bResetColorsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bResetColorsActionPerformed
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
// color all nodes black
Node[] nodes = model.getUndirectedGraph().getNodes().toArray();
for(Node n : nodes) {
n.getNodeData().setColor(0, 0, 0);
}
// color all edges black
Edge[] edges = model.getUndirectedGraph().getEdges().toArray();
for(Edge e : edges) {
e.getEdgeData().setColor(0, 0, 0);
}
}
示例2: layoutGraph
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
public void layoutGraph() {
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
ForceAtlas2 layout = new ForceAtlas2(null);
// YifanHuLayout layout = new YifanHuLayout(null, new StepDisplacement(1f));
layout.setGraphModel(graphModel);
layout.initAlgo();
layout.resetPropertiesValues();
// layout.setOptimalDistance(200f);
layout.setEdgeWeightInfluence(0.1);
layout.setScalingRatio(50.0);
layout.setLinLogMode(false);
int maxSteps = 100;
for (int i = 0; i < maxSteps && layout.canAlgo(); i++) {
layout.goAlgo();
}
layout.endAlgo();
}
示例3: setGraph
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
private void setGraph() {
GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
if (exportVisible) {
graph = graphModel.getGraphVisible();
} else {
graph = graphModel.getGraph();
}
}
示例4: setGraphModel
import org.gephi.graph.api.GraphModel; //导入依赖的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();
}
示例5: bootstrapGephi
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
private GraphModel bootstrapGephi() {
// boostrap gephi
Lookup lookup = Lookup.getDefault();
ProjectController pc = lookup.lookup(ProjectController.class);
pc.newProject();
@SuppressWarnings("unused")
Workspace workspace = pc.getCurrentWorkspace();
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
return graphModel;
}
示例6: getAverageClusteringCoefficient
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
/**
* Indicates to which degree nodes in the network tend to cluster together
*/
public static double getAverageClusteringCoefficient(GraphModel graphModel, AttributeModel attributeModel) {
ClusteringCoefficient clusteringCoefficient = new ClusteringCoefficient();
clusteringCoefficient.execute(graphModel, attributeModel);
double sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (double)node.getAttributes().getValue(ClusteringCoefficient.CLUSTERING_COEFF);
}
return sum / graphModel.getGraph().getNodeCount();
}
示例7: getAverageGraphDistance
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
private static double getAverageGraphDistance(GraphModel graphModel, AttributeModel attributeModel, String distanceType) {
GraphDistance graphDistance = new GraphDistance();
graphDistance.setDirected(true);
graphDistance.setNormalized(true);
graphDistance.execute(graphModel, attributeModel);
double sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (double)node.getAttributes().getValue(distanceType);
}
return sum / graphModel.getGraph().getNodeCount();
}
示例8: getAverageDegree
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
private static double getAverageDegree(GraphModel graphModel, AttributeModel attributeModel, String degreeType) {
Degree degree = new Degree();
degree.execute(graphModel, attributeModel);
int sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (int)node.getAttributes().getValue(degreeType);
}
return sum / graphModel.getGraph().getNodeCount();
}
示例9: filterGraph
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
private void filterGraph() {
FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
SelectionFilter degreeFilter = new SelectionFilter(controller.getSelectedNodes());
Query query = filterController.createQuery(degreeFilter);
GraphView view = filterController.filter(query);
graphModel.setVisibleView(view);
}
示例10: setGraphModel
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
@Override
public void setGraphModel(GraphModel graphModel) {
this.graphModel = graphModel;
}
示例11: setGraphModel
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
@Override
public void setGraphModel(GraphModel graphModel) {
this.graphModel = graphModel;
}
示例12: setGraphModel
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
@Override
public void setGraphModel(GraphModel gm) {
this.graphModel = gm;
}
示例13: setGraphModel
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
@Override
public void setGraphModel(GraphModel graphModel) {
this.graphModel = graphModel;
// Trick: reset here to take the profile of the graph in account for default values
resetPropertiesValues();
}
示例14: getAverageInDegree
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
public static double getAverageInDegree(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageDegree(graphModel, attributeModel, Degree.INDEGREE);
}
示例15: getAverageOutDegree
import org.gephi.graph.api.GraphModel; //导入依赖的package包/类
public static double getAverageOutDegree(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageDegree(graphModel, attributeModel, Degree.OUTDEGREE);
}