如何获得 JUNG 边长?
如何从 JUNG 中构建的图形中获取边长?以像素为单位就好了,但如果更复杂,请解释一下。
How do I get an edge length from a graph constructed in JUNG? In pixels would be nice, but if it's more complicated, then please explain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您可以通过获取布局中每个顶点的位置然后进行明显的数学运算来获取布局坐标中的距离。
其次,我不明白为什么您希望链接权重成为布局如何放置顶点的函数。这似乎有点随意。通常,如果有的话,情况恰恰相反(边权重决定布局中的顶点位置)。
最后,假设您使用 Dijkstra{Distance,ShortestPath},您可以提供您喜欢的任何类型的边权重;查看 Javadoc 了解如何执行此操作。
您想要解决的根本问题是什么?
First, you can get the distance in Layout coordinates by getting the position for each vertex in the Layout and then doing the obvious math.
Second, I don't understand why you want the link weight to be a function of how the layout placed the vertices. This seems kind of arbitrary. Usually, if anything, it's the other way around (edge weight determines vertex placement in Layout).
Finally, assuming you're using Dijkstra{Distance,ShortestPath}, you can provide any kind of edge weights that you like; take a look at the Javadoc for how to do this.
What's the underlying problem you're trying to solve?