1
votes

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
Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Refer this link on how you could ask a good question stackoverflow.com/help/how-to-askWesam

1 Answers

2
votes

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.