How to implement a cluster graph in java
I want to draw a cluster graph like this. Is there a library for this? How should I bui开发者_开发问答ld the data structure to contain the input data? Like a dictionary with key as the node itself and value as an array with the nodes connecting to. What could be a more precise term to describe this?
Try a library like JUNG.
JUNG is a framework made for displaying and working with any kind of graphs and networks on Java. It supports transitions, collapsing, complex layouts, …
About the data structure: It is complicated, and depends on the type
of cluster (bidirectional or unidirectional).
In the last case, you shouldn't use a Dictionary
,
or connections would be stored twice.
Look at JUNG, for example. I think its data is Serializable.
Take a look at JGraphT: it provides the data structures and you can then render that using JGraph.
精彩评论