I wanted to follow this guide to add a now Int-attribute "val" to my nodes. The tutorial suggests to use
AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
AttributeModel model = ac.getModel();
but AttributeController
does not exist / cannot be found.
I am using the most up-to-date toolkit .jar version 0.9.1, downloaded from the download page. Here you can find the JavaDoc.
Question: How to add a val attribute to my graph's nodes, so that node.setAttribute("val", 1)
works? (Currently throws java.lang.IllegalArgumentException: The column 'val' is not found
)
I just found it out due to a changlog notice in the JavaDoc:
(April 07 2013) Complete rewrite of the GraphAPI and add GraphStore as dependency. The new API is entirely defined in the GraphStore project and Gephi makes it available through the GraphAPI. The AttributesAPI functionalities have been consolidated into the new graph API and therefore has been removed. There is too many API changes to be listed all but notable ones are the following.
- All attribute features (e.g. add column) are now directly accessible from the GraphModel, and there's no more AttributeModel.
A working way is the following:
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
graphModel.getNodeTable().addColumn("val", Integer.class);