Saving jung graph with Custom Node and Edge

 ̄綄美尐妖づ 提交于 2019-12-11 03:55:20

问题


How can one save a JUNG graph with a custom node and edge? Problem is, till now we have been able to save a JUNG graph of fields with primitive types like integer, string, etc. But the JUNG graph custom node and edge we are working with involves using datatypes like ArrayList and some more complicated datastructures inside the the edge and/or node. I have searched a lot on the web but came across how to save a simple custom node/edge using only int or string or double.

Moreover, my aim is not to save an image file like jpeg, etc. The point is to save it in a format which can easily be loaded again into the JUNG format when required to perform certain operations.

How can one save such a graph?

Thanks.


回答1:


Here are two links that address saving a Jung Graph in the fashion you have described. The main point being you need to save using GraphML in order to save the data of the nodes.

This link is saving using the GraphML writer. http://halfclosed.wordpress.com/2010/12/04/graphml-with-jung-saving/

This link is about loading from a GraphML file. http://halfclosed.wordpress.com/2010/12/04/graphml-with-jung-loading-from-graphml/

GraphML is a file format for saving graphs, as it stores the data. It is worth noting that it doesn't necessarily save the layout. Unfortunately saving your data in the GraphML format is not completely trivial, but it can be done.



来源:https://stackoverflow.com/questions/11063810/saving-jung-graph-with-custom-node-and-edge

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!