Re: [eclipse-users] Help with displaying a binary tree with graphviz

From: Kish Shen <kish_at_crosscoreop.com>
Date: Thu, 10 Jan 2008 07:33:36 +0000
Hi,

In your first graph, there are only one edge from each node, so I am not 
sure if it is possible to display each node to the side in the way you 
want using graphviz, which will have no knowledge that each of your node 
is `missing' the other edge. For debugging purposes, if you display the 
edges as well as the nodes, then it seems to me there will be no 
confusion, as you can clearly see that there is one edge coming out of 
the node in such cases.

Cheers,

Kish

William Heath wrote:
> Hi All,
>
> I am working on creating intervals in a binary tree.  I have created
> some code to display binary trees to assist me with debugging etc...
> using the graphviz library of eclipse.  My problem is it is not clear
> how to display the tree correctly.  For example:
>
>  G=(graph with [size:3, nodes:[](1,2,3), adj:[]([e(1,2,1),
> e(2,3,1)],[])]), graphviz:(view_graph(G)).
>
> This just shows the nodes like so:
>
> 1
>
> 2
>
> 3
>
> Instead of
>
> 1
>
>    2
>
>       3
>
> Which is how it should look.  This will show a binary tree correctly:
>
> G=(graph with [size:5, nodes:[](1,2,3,4,5),
>         adj:[]([e(1,2,1), e(1,3,1), e(3,5,1), e(3,4,1)],[])]),
>         graphviz:(view_graph(G)).
>
> Anyway, I am sure it is an easy problem to solve just wondering if
> anyone knows a quick fix.
>
> -Tim
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_crosscoreop.com
> http://www.crosscoreop.com/mailman/options/eclipse-users
>   
Received on Thu Jan 10 2008 - 07:33:45 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET