Hello to all, I'm working in an application wich have to assign some information to the nodes, this information could be, for example, the groups to each node belongs, or in general, another type of information wich is not the standar node's information such as position or color.
I was writing an importer plugin based on the GraphML importer, but when I tried to add some methods for the node, whether implementing the NodeDraft or extending the NodeDraftImpl, I have errors, in the first case in execution time (ClassCastException) and in the second case, (even when Netbeans solve all the imports) a compilation time error from Ant.
I don't know if I'm doing something, or all, wrong or I'm making it more complicated than it really is. To summarize, I want to add to the nodes external information and use it as attributes in Gephi.
Sorry for the long text and thanks.
Nodes attributes and import plugin
- juandavidcruz
- Posts:2
- Joined:07 Dec 2010 20:11 [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
-
- Gephi Community Manager
- Posts:964
- Joined:09 Dec 2009 14:41 [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Re: Nodes attributes and import plugin
Hi,
Take a look at this HowTo: http://wiki.gephi.org/index.php/Toolkit ... attributes
Basically you don't need to implement or extend something.
First declare the node columns for attributes. Example:
Then assign a value for each node:
This is the same way for edges.
Don't hesitate to ask more questions if you need!
See you at EGC'11
Take a look at this HowTo: http://wiki.gephi.org/index.php/Toolkit ... attributes
Basically you don't need to implement or extend something.
First declare the node columns for attributes. Example:
Code: Select all
//Add boolean column
AttributeColumn testCol = model.getNodeTable().addColumn("test", AttributeType.BOOLEAN);
Code: Select all
//Write values to nodes
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
for (Node n : graphModel.getGraph().getNodes()) {
n.getNodeData().getAttributes().setValue(testCol.getIndex(), Boolean.TRUE);
}
Don't hesitate to ask more questions if you need!
See you at EGC'11
- juandavidcruz
- Posts:2
- Joined:07 Dec 2010 20:11 [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Re: Nodes attributes and import plugin
Cool, thanks, this is what I needed.
Et oui, on se voit à EGC'11
Et oui, on se voit à EGC'11