Drawing binary search tree with Cytoscape.js

782 views Asked by At

I am trying to draw a binary search tree using Cytoscape.js. I am using Dagre layout. In my tree, each node has exactly two children - I am creating nodes with 'null' labels for empty subtrees. My problem is that sometimes the left child is on the right side and vice versa.

How can I set which node should be the left child and which should be the right?

1

There are 1 answers

1
maxkfranz On BEST ANSWER

From the dagre documentation, the only parameters that look as though they could affect order include:

  • The ordering of the nodes and edges in the graph itself.
  • The ranker option.

If neither one allows specifying order in the resultant dagre layout, then you'll have to file a feature request with dagre. The cytoscape-dagre package is just a wrapper.