Search code examples
javagraphtreejung

How to reverse arrow direction of the tree (from leaves to root) in JUNG?


I am new to JUNG. I have drawn my tree, however need to reverse arrow's direction from child to parent vertices.

    TreeLayout<VertexLiteral, EdgeLiteral> treeLayout=
            new TreeLayout<VertexLiteral, EdgeLiteral>(tree);
    VisualizationViewer<VertexLiteral, EdgeLiteral> vv =
            new VisualizationViewer<VertexLiteral,EdgeLiteral>(treeLayout, new Dimension(600,600));

Any solution?

Cheers


Solution

  • You can provide your own edge renderer, or customize BasicEdgeRenderer so that it draws the arrows at the other end. Should be pretty easy, I.e. a one or two line change inside drawSimpleEdge.