本文整理汇总了Java中org.gephi.graph.api.GraphController类的典型用法代码示例。如果您正苦于以下问题:Java GraphController类的具体用法?Java GraphController怎么用?Java GraphController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphController类属于org.gephi.graph.api包,在下文中一共展示了GraphController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NetworkStatistics
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public NetworkStatistics() {
controller = Lookup.getDefault().lookup(StatisticsController.class);
graph = Lookup.getDefault().lookup(GraphController.class).getModel()
.getGraph();
allStats = new ArrayList<Statistics>();
cc = (ConnectedComponents) controller.getBuilder(
ConnectedComponents.class).getStatistics();
allStats.add(cc);
degree = (Degree) controller.getBuilder(Degree.class).getStatistics();
allStats.add(degree);
density = (GraphDensity) controller.getBuilder(GraphDensity.class)
.getStatistics();
allStats.add(density);
distance = (GraphDistance) controller.getBuilder(GraphDistance.class)
.getStatistics();
allStats.add(distance);
}
示例2: bResetColorsActionPerformed
import org.gephi.graph.api.GraphController; //导入依赖的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);
}
}
示例3: layoutGraph
import org.gephi.graph.api.GraphController; //导入依赖的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();
}
示例4: Vertex
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
/**
* General constructor for a vertex
*
* @param id
*/
public Vertex(int id) {
this.internalNode = Lookup.getDefault().lookup(GraphController.class)
.getModel().factory().newNode();
setId(id);
setSize(DEFAULT_SIZE);
setFillColor(DEFAULT_FILL_COLOR);
}
示例5: BrowsableNetwork
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
/**
* Creates a Network accessor object without modifying the underlying graph
* structure.
*
* @param clearGraph
*/
public BrowsableNetwork(boolean clearGraph) {
this.graphModel = Lookup.getDefault().lookup(GraphController.class)
.getModel();
setGraph();
if (clearGraph)
this.graph.clear();
}
示例6: Edge
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public Edge(Vertex source, Vertex target) {
this.internalEdge = Lookup.getDefault().lookup(GraphController.class)
.getModel().factory()
.newEdge(source.internalNode, target.internalNode);
setColor(DEFAULT_COLOR);
}
示例7: bootstrapGephi
import org.gephi.graph.api.GraphController; //导入依赖的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;
}
示例8: initializing
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public static void initializing() {
if (!initialized) {
pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
workspace = pc.getCurrentWorkspace();
graph_model = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
the_graph = graph_model.getUndirectedGraph();
}
the_graph.clear();
// System.gc();
}
示例9: Controller
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
/**
* Constructor
*/
public Controller() {
// initialize
storage.initialize();
imagePanel = new ImagePanel(this);
listPanel = new ListPanel(this);
mainFrame = new MainFrame(this, new MainPanel(imagePanel, listPanel));
// checks for beginning
if(Lookup.getDefault().lookup(GraphController.class).getModel() == null) {
// found null pointer
MessageHandler.showErrorMessage("No project created. Please create a new project in Gephi first.");
mainFrame.dispose();
System.exit(0);
}
// load image
ImageLoader.loadImage(mainFrame, imagePanel, messages);
// ask if load points from gephi
if(JOptionPane.showConfirmDialog(mainFrame, "Do you want to load your existing data from Gephi into the GraphCreator?", "Existing data", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
storage.loadDataFromGephi();
updateNodes(storage.getNodes());
updateEdges(storage.getEdges());
}
else {
// clear current model
Lookup.getDefault().lookup(GraphController.class).getModel().clear();
}
}
示例10: filterGraph
import org.gephi.graph.api.GraphController; //导入依赖的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);
}
示例11: LouvainClustering
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public LouvainClustering() {
this.pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
this.workspace = pc.getCurrentWorkspace();
this.graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
this.factory = graphModel.factory();
this.partitionController = Lookup.getDefault().lookup(PartitionController.class);
}
示例12: init
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public void init() {
this.graphModel = Lookup.getDefault().lookup(GraphController.class)
.getModel();
setGraph();
this.graph.clear();
}
示例13: convert
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
/**
*
* @param srcpath
* @throws IOException
*/
public void convert(String srcpath) throws IOException {
File graphmlFile = new File(srcpath);
// Init a project - and therefore a workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace = pc.getCurrentWorkspace();
// get import controller
ImportController importController = Lookup.getDefault().lookup(ImportController.class);
// Import file
Container container = importController.importFile(graphmlFile);
// Append imported data to GraphAPI
importController.process(container, new DefaultProcessor(), workspace);
graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
}
示例14: initialize
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
/**
* This method initalizes the connection
* @return true if successful, false otherwise
*/
public boolean initialize() {
// get model
model = Lookup.getDefault().lookup(GraphController.class).getModel();
return (model != null);
}
示例15: load
import org.gephi.graph.api.GraphController; //导入依赖的package包/类
public void load(QueryWindowData newDataset) {
if (newDataset == null)
return;
currentQueryWindow = newDataset;
if (skip) {
skip = false;
return;
}
if (this.selectedNodes == null || this.currentQueryWindow == null) {
logger.info("Not all data yet, not displaying graph");
return;
}
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
if (graphModel != null) {
if (!keep)
graphModel.getGraph().clear();
else
graphModel.getGraph().clearEdges();
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
projectController.cleanWorkspace(workspace);
// Gephi doesn't terminate these Threads. Since many of these threads lead to OutOfMemory Errors,
// kill all left-over threads manually.
terminateThreads("DHNS View Destructor");
}
// import to container
Container container = Lookup.getDefault().lookup(ContainerFactory.class).newContainer();
GephiImporter gImporter = new GephiImporter(currentQueryWindow, ipMap, this.selectedNodes);
ContainerLoader loader = container.getLoader();
gImporter.execute(loader);
// process data from container into internal graph structure
ImportController importController = Lookup.getDefault().lookup(ImportController.class);
importController.process(container, new CustomProcessor(), workspace);
// update view
setChanged();
notifyObservers();
}