← Back to team overview

gephi.team team mailing list archive

Re: [Question #107417]: Multiple Graphs Per Workspace

 

Question #107417 on Gephi changed:
https://answers.launchpad.net/gephi/+question/107417

    Status: Open => Answered

Mathieu Bastian proposed the following answer:
Hi Chris,

No the rule is one graph structure per workspace. When you do
gc.getModel() you get the GraphModel of the current workspace. Each
workspace has one GraphModel.

That is how you can iterate over workspaces. You need to add ProjectAPI
dependency on your module.

GraphController gc = Lookup.getDefault().lookup(GraphController.class);
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
for(Workspace w : pc.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
   Graph graph = gc.getModel(w).getGraph();
}

But if your aim is to do filtering and create subgraphs of the main
graph, you should have a look on GraphView
(http://gephi.org/docs/api/org/gephi/graph/api/GraphView.html) in
GraphAPI. You can define subgraphs. Then when your altered your view you
can set it as the "visible view.

-- 
You received this question notification because you are a member of
Gephi Team, which is an answer contact for Gephi.