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!
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.
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
If you just want to visualize it for debugging and are using a Unix-like operating system, you can try ddd.