Reputation: 29483
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 realize a resource-allocation graph:
I already have two classes: MonitorInfo and ThreadInfo. I would like to use both as vertices in my graph.
Upvotes: 1
Views: 244
Reputation: 46878
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>
.
Upvotes: 3