开发者

Jung weighted edges from graphml

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜