The graph interface clearly gives two paramters:
Graph<Vertex, Edges>
I would like to draw a graph with two different kind of vertices. I have not found anything to realize this with the JUNG API is it possible or do I have to write a work around?
In my case I want to r开发者_运维问答ealize a resource-allocation graph:
I already have two classes: MonitorInfo and ThreadInfo. I would like to use both as vertices in my graph.
You could make MonitorInfo
and ThreadInfo
implement a common interface. For example, they could both implement Info
. Now, you can declare the graph as type Graph<Info, Edges>
. Of course, JUNG doesn't come with the functionality to isolate just the MonitorInfo
vertices or just the ThreadInfo
vertices, but at least it will work with some type safety (as opposed to using a Graph<Object, Edge>
.
精彩评论