views:

178

answers:

1

Hi, When I have implemented binary trees , one of the first utilities one writes is a visualization function that given a tree prints it to the screen.

using cout function to print it every time like a stack is probleme to me , I can't represent the value of my job .

Printing trees properly in ASCII is quite difficult to understand.Meanwhile,It can't represent your tree and your operations in clear view.

With some researches I found a tool named Graphviz – Graph Visualization Software –which is a language (called DOT) and a set of tools for automatically generating visualizations of graphs. Graphviz is a tool for drawing graphs, not trees, that's why I can't use it .And it's very difficulte to implement C++ code for this .

I'm searching for some codes,Algorithmes or methode to show my tree. I'm thinking to use some Libraries like GTK , QT,STL or using WPF 'cause I'm working with VStudio C++ .Can I use theme!which is better!

+3  A: 

A tree is also a graph; you can use Graphviz just fine. And the DOT format is very simple to output. See the Graphviz gallery for examples, including trees.

Arkku
How,have you a link for toturial! you used it before or !
T_Geek
The simplest way is to just print your graph in the DOT format (see the Graphviz gallery; you can view the DOT for each of the sample graphs by clicking the image). You can pipe the DOT directly to Graphviz or write it into a temporary file on disk. Then you can call Graphviz to produce an image, either as a file on disk or again by piping it into your software which could read it into memory and display it on screen.
Arkku