1

Is there any way I could visualize a binary tree in java and C++? It could be a plugin for eclipse or VC++(although I dont think a plugin would be capable) or, it could be a library that enables you to draw them. I want to do this with the minimum amount of work possible. I can do it now with C++ and Win32 but that isn't an option because it requires too much time to code the damned thing. I also know that there might not be quite a simple solution to this, but I am looking for the best possible one out there, for both languages. The BST structure I talk of here will be custom, not a library one. Thanks!

4

3 に答える 3

3

I think AT&T graphviz and its dot.exe is as easy as it gets to use. You can all it from inside Java if you must.

于 2012-04-28T00:28:43.863 に答える
2

If you can output your binary tree in DOT format, it's pretty easy to visualize it. DOT is a super simple language which you should be able to emit in just a few lines of code. An example looks like this:

 digraph graphname {
     a -> b -> c;
     b -> d;
 }

Which generates http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/DotLanguageDirected.svg/168px-DotLanguageDirected.svg.png

Wikipedia has more: http://en.wikipedia.org/wiki/DOT_language

于 2012-04-28T00:28:55.783 に答える
2

If you just want to visualize it for debugging and are using a Unix-like operating system, you can try ddd.

于 2012-04-28T00:31:01.803 に答える