[Gephi-plugins] Access to Graph inside Generator Plugin

Mathieu Bastian mathieu.bastian at gmail.com
Tue Jul 27 08:37:16 CEST 2010


Hi,

I think the best solution is to look for nodes in the current graph.

You can do this by doing:

//Get the GraphModel of the current workspace
GraphModel graphModel =
Lookup.getDefault().lookup(GraphController.class).getModel();

//Get the current graph
Graph graph = graphModel.getGraph();

//Iterate over nodes
for(Node n : graph.getNodes()) {
}

Add GraphAPI as a dependency of your plugin if its not already done.

Mathieu

On Tue, Jul 27, 2010 at 3:02 AM, Shaun Roach <sroach at alchemyapi.com> wrote:

> Gephi Team,
>
> I am trying to make multiple calls to the Generate function of my plugin
> produce interconnected graphs (for instance, if the generate script is run
> on two articles about Barack Obama, there will be a single Obama node that
> both share).
>
> I have it working with a hashtable stored in my Generator object.  However,
> it fails when a user makes a new graph( or deletes old nodes) because my
> hashtable does not get updated.
>
> My question is:  Is there a way to either:
>  1.  Receive an event notification when a node is removed, or a new graph
> is created?
>  2.  Or, access all the current nodes that are currently in the graph?
>
> and, is there a way to do this inside of a generator object.
>
> Thanks for your time!
>
> Shaun
> _______________________________________________
> gephi-plugins mailing list
> gephi-plugins at lists.gephi.org
> http://gephi.org/mailman/listinfo/gephi-plugins
>


More information about the gephi-plugins mailing list