romejoe
romejoe

Reputation: 443

visualize c++ data structure

I am looking for a program to help me debug a tree in c++. My tree has thousands of nodes and I want to view the tree as it forms and view problem nodes and branches. Operating system doesn't matter. Anyone know of a program that can do this?

Upvotes: 3

Views: 2330

Answers (4)

西风逍遥游
西风逍遥游

Reputation: 94

I have written a library called DSViz which is used to do this job. You can find it here: https://github.com/sunxfancy/DSViz

You need to write a few lines of code to use the API to generate a graphviz file so that you can draw the figure using addition tools.

Upvotes: 0

neuro
neuro

Reputation: 15180

The only practical way I know is to write your own ! A good design solution is to implement a visitor design pattern. Then you can have different visitor like :

  • a print visitor, that print your tree in the console (not practical as you say you have a lot of nodes)
  • a serialize visitor : It will write your tree in a file.

You can then "debug" by calling the appropriate visitor at key points.

my2c

Upvotes: 1

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272467

Have you considered Dot?

Upvotes: 0

Nikolai Fetissov
Nikolai Fetissov

Reputation: 84151

Don't know what platform you are at, but DDD is pretty good with this, though can't say anything about its performance on huge sets.

Upvotes: 1

Related Questions