Gephi:如何向节点添加新属性?

Gephi: How to add a new attribute to nodes?

我想跟随 this guide 向我的节点添加一个现在的 Int 属性 "val"。本教程建议使用

AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
AttributeModel model = ac.getModel();

AttributeController 不存在/找不到。

我正在使用最新的工具包 .jar 版本 0.9.1,从 the download page. Here you can find the JavaDoc.

下载

问题: 如何将 val 属性添加到我的图形节点,以便 node.setAttribute("val", 1) 起作用? (当前抛出 java.lang.IllegalArgumentException: The column 'val' is not found

由于 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.

工作方式如下:

GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
graphModel.getNodeTable().addColumn("val", Integer.class);