Q: How to change arrow position or remove it from an edge ? (JUNG)

做~自己de王妃 提交于 2019-12-13 08:37:24

问题


What the question states.I have many arrows connecting to one Node and it looks very cluttered on the graph. Any way to relocate the arrows towards the center or remove them ?


回答1:


By default, directed edges are rendered with arrowheads on them so that you can see the direction of the edge.

If you don't want the arrowheads to be present at all:

visualizationViewer.getRenderContext().setEdgeArrowPredicate(false);

If you want the arrowheads to be present, but rendered in the middle of their respective edges instead of at their target:

visualizationViewer.getRenderer()
    .getEdgeRenderer()
    .setEdgeArrowRenderingSupport(
        new CenterEdgeArrowRenderingSupport<>());

If you want to use a different edge shape that shows the edge direction differently:

visualizationViewer
    .getRenderContext()
    .setEdgeShapeTransformer(EdgeShape.wedge(10));

Finally, if you don't want directed edges, then you can use an undirected graph. (The edges of SparseMultigraph are undirected by default.)

These capabilities are demonstrated in PluggableRendererDemo, which is one of the samples available as part of the JUNG distribution. Note that these APIs are accurate for JUNG 2.1.*, but some things will be changing for the upcoming 3.0 release.




回答2:


Changed the type of the graph From DirectedSparseMultigraph to SparseMultigraph and fixed the issue I was having.



来源:https://stackoverflow.com/questions/48036280/q-how-to-change-arrow-position-or-remove-it-from-an-edge-jung

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!