简体   繁体   English

具有两个不同验证的 JUNG 图

[英]JUNG graph with two different verices

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?我还没有发现任何东西可以通过 JUNG API 实现这一点,是否有可能或者我必须写一个解决方法?


In my case I want to realize a resource-allocation graph :就我而言,我想实现一个资源分配图

I already have two classes: MonitorInfo and ThreadInfo.我已经有两个类:MonitorInfo 和 ThreadInfo。 I would like to use both as vertices in my graph.我想在我的图中将两者都用作顶点。

You could make MonitorInfo and ThreadInfo implement a common interface.您可以使MonitorInfoThreadInfo实现一个通用接口。 For example, they could both implement Info .例如,他们都可以实现Info Now, you can declare the graph as type Graph<Info, Edges> .现在,您可以将图形声明为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> .当然,JUNG 不具备隔离MonitorInfo顶点或ThreadInfo顶点功能,但至少它可以在某种类型安全的情况下工作(而不是使用Graph<Object, Edge>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM