来自 graphml 的荣格加权边
我正在使用荣格2.0。我有一个带有加权边缘的 graphml 文件。我正在使用 graphml 阅读器来读取文件并创建图表。当我使用 FRLayout 可视化该图时,我发现该图没有反映与边相关的权重。我是否必须专门为边缘分配权重?如果是这样,我该怎么做?
I am using Jung 2.0. I have a graphml file with weighted edges. I am using a graphml reader to read the file and create the graph. When I visualize the graph with a FRLayout, I observe that the graph does not reflect the weights associated with the edges. Do I have to specifically assign the weights to the edges? If so, how do I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FRLayout 实际上并不支持当前设计的边缘权重(请参阅文档)。
也就是说,适应起来并不困难,因此它将采用每条边的“拉伸”因子,该因子可能是边权重的函数,而不是所有边的单个值(这是目前所具有的)。
您还需要从 GraphMLReader 构建的元数据中提取权重,然后将其传递给(修订后的)FRLayout。 Graph 仅保存图拓扑;诸如标签、权重或其他元数据之类的任何内容都需要显式传递给想要使用它的东西。查看 Transformer 接口的使用。
如果您需要更多详细信息,请告诉我。
FRLayout doesn't actually work with edge weights as currently designed (see the documentation).
That said, it would not be difficult to adapt so that it would take a per-edge 'stretch' factor that could be a function of edge weight, rather than a single value for all edges (which is what it currently has).
You would also need to extract the weights from the metadata that GraphMLReader builds, and then pass that along to the (revised) FRLayout. The Graph holds only the graph topology; anything like labels or weights or other metadata needs to be explicitly passed to something that wants to work with it. Take a look for uses of the Transformer interface.
Let me know if you need more details.