PDA

View Full Version : 'Circular' Tree Visualization



jw72
28th February 2018, 20:16
I was wondering if anyone has any advice on implementing a circular 'phylogenetic' type binary tree visualization using QTGraphics - the type of tree where the root is in the center and the branches circle around a set radius.

Something like this, except with the labels replaced with dots:
12781

I could not find any pre-made widgets that were suited for this purpose.

I'm currently using the 'Elastic Nodes' setup as a template - which utilizes QTGraphicsScene and QTGraphicsView, and have managed to create a standard tree visualization with dynamically set distances:
12782

But wanted to switch to a circular format like the image above, if possible.

Many thanks in advance.

d_stranz
1st March 2018, 17:23
I have implemented a similar dendrogram tree visualization as you show in your second figure. The phylogenetic layout is harder and my googling for a library doesn't yield any C++ libraries. From what I have read, the algorithm to create this type of layout (like that used in Elastic Nodes) is called a "force-directed layout", where each node is assigned a repulsive force which acts on other nodes, and the goal of the layout is to minimize the total repulsion between all nodes. My guess is that it is stepwise - put the root node at the center, then progressively add nodes at locations that maintain their connectivity and approximate branching distances, but minimize the repulsion, adjusting the other nodes as needed. I'd also guess that more sophisticated algorithms allow each node to carry a weight that determines its repulsivity - not all nodes are equal, in other words.

In the Elastic Nodes example, the nodes don't have weights, but the edges between them have spring constants. A node is in an optimum position when the sum of the forces acting on it through each connected edge is minimized. The algorithm is somewhat similar in that both ends of the edges are moveable, and moving one node affects all other nodes in the network.

jw72
2nd March 2018, 21:01
Thanks, I will give this a try - perhaps setting branches at an angles and then using the 'springing' feature of Elastic Nodes to make sure nodes don't overlap.

I appreciate the helpful advice!