使用自定义节点和边缘保存弹出图 [英] Saving jung graph with Custom Node and Edge

查看:119
本文介绍了使用自定义节点和边缘保存弹出图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用自定义节点和边缘保存JUNG图形?问题是,到现在为止,我们已经能够保存带有诸如整数,字符串等原始类型的字段的JUNG图形。但是我们正在使用的JUNG图形定制节点和边缘涉及使用像ArrayList这样的数据类型和一些更复杂的数据结构边缘和/或节点。
我在网上搜索了很多,但遇到了如何使用int或string或double保存简单的自定义节点/边缘。



此外,我的目标不是保存像jpeg等图像文件。重点是将其保存为一种格式,在需要执行某些操作时可以轻松将其再次装入JUNG格式。



如何保存这样的图表?



谢谢。

解决方案

这里有两个链接,说明以您所描述的方式保存Jung图。主要的是你需要使用GraphML来保存节点的数据。



这个链接是使用GraphML编写器保存的。
http://halfclosed.wordpress.com/ 2010/12/04 / graphml-with-jung-saving /

这个链接是关于从GraphML文件加载的。
http:// halfclosed。 wordpress.com/2010/12/04/graphml-with-jung-loading-from-graphml/

GraphML是一种保存图形的文件格式,因为它存储数据。值得注意的是,它不一定会保存布局。不幸的是,将数据保存为GraphML格式并不是很简单,但可以完成。


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.

解决方案

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.

这篇关于使用自定义节点和边缘保存弹出图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆