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



我想按照这个指南给我的节点添加一个int属性"val"。本教程建议使用

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

但是AttributeController不存在/找不到。

我正在使用最新的工具箱.jar 0.9.1版本,从下载页面下载。您可以在这里找到JavaDoc。

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

我刚刚发现它是由于JavaDoc中的更改日志通知:

(2013年4月7日)完全重写GraphAPI,并添加GraphStore作为依赖项。新的API完全在GraphStore项目中定义,Gephi使其通过GraphStore可用。AttributesAPI的功能已经被整合到新的图形API中,因此被删除了。有太多的API的变化,以列出所有但值得注意的是以下。

  • 所有属性特性(例如添加列)现在都可以直接从GraphModel中访问,并且不再有attributemmodel。

工作方式如下:

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

最新更新