如何更改JUNG中边的边标签?
我正在使用 JUNG API 进行图形可视化。我不知道如何更改图中边缘的边缘标签。
情况是该图已经在程序中创建了。我不断删除边缘和节点,并且找到了一种方法来对这些内容进行动画处理并在图表中更新它们。一些在线演示很有帮助。但是以后有没有办法改变图中一条边的边标签呢?
我知道 JUNG 要求边缘标签是唯一的。
I'm using the JUNG API for graph visualization. I cannot figure out how to change the edge label of an edge in the graph.
The situation is that the graph has already been created in the program. I keep dropping edges and nodes and I've found a way to animate those things and update them in the graph. Some of the demos online are helpful. But is there no way to change an edge label of an edge in the graph later?
I understand that JUNG requires the edge labels to be unique.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JUNG 中边缘标记的基础知识由以下代码片段演示:
这里,vv 是您的 VisualizationViewer,MyEdge 是指您的自定义边缘类。就我而言,我定义了函数 getWeight() 和 getCapacity() 来返回边缘的权重和容量。
然后,我为每个边创建了一个弹出菜单,允许用户输入边权重和容量,然后使用 setWeight() 和 setCapacity() 函数来更新我的边。我从 http://www.grotto-networking.com/JUNG 了解了如何准确创建边缘弹出窗口/
您可以借用此示例来设置您自己的边缘标签。
The basics of edge labelling in JUNG are demonstrated by this snippet of code:
Here, vv is your VisualizationViewer and MyEdge refers to your custom edge class. In my case, I've defined the functions getWeight() and getCapacity() to return the weight and capacity of my edge.
Then I created a popup menu for each edge that allows the user to enter the edge weight and capacity and then used the setWeight() and setCapacity() functions to update my edge. I picked up how exactly to create the edge popups from http://www.grotto-networking.com/JUNG/
You could borrow from this example to set your own edge labels.