2016-09-19 384 views
1

我想要按照this guide的方法爲我的節點添加一個現在的Int屬性「val」。本教程建議使用Gephi:如何向節點添加新的屬性?

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

AttributeController不存在/無法找到。

我使用的是最新的工具包.jar版本0.9.1,從the download page下載。在這裏您可以找到the JavaDoc

問題:如何添加VAL屬性,我圖的節點,使node.setAttribute("val", 1)的作品? (目前拋出java.lang.IllegalArgumentException: The column 'val' is not found

回答

1

我只是發現它因在JavaDoc一個changlog注意:GraphAPI的

(2013年4月7日)全部重新編寫並加入GraphStore的依賴。新的API完全在GraphStore項目中定義,Gephi通過GraphAPI提供。 AttributesAPI功能已合併到新的圖形API中,因此已被刪除。有太多的API更改被列出,但是值得注意的是以下內容。

  • 現在可以直接從GraphModel訪問所有屬性特徵(例如添加列),並且不再有AttributeModel。

的工作方式如下:

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