Saving jung graph with Custom Node and Edge

2019-07-21 04:28发布

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.

标签: graph save jung
1条回答
狗以群分
2楼-- · 2019-07-21 04:54

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.

查看更多
登录 后发表回答