Found out the solution. Instead of using OrderedKAryTree
use DelegateTree
with DirectedOrderedSparceGraph
Here is how the graph should be initialized:
DelegateTree<V, E> graph = new DelegateTree<V, E>(
new DirectedOrderedSparseMultigraph<V, E>());
V and E can be any Object
.
This does not solve the problem of OrderedKAryTree
getting rendered incorrectly but it can surely help you display a binary search tree.