Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm trying to generate a call tree for code I'm working on (I didn't write it) to help me understand it. I want to be able to manually enter each function and the functions it calls (as children), thus building the tree. But I'd like it to automatically organize and position the chart so that nothing overlaps without my having to move everything around every time I add something. For example, here's the structure of the kind of data I'd want to put in, in crappy Lispesque format:

( initAll //root node
  ( //root node's children - functions it calls
    ( initDisplay () ) //this child is a leaf
    ( initControlBar
       ( //initControlBar's children - functions it calls
         ( addButtons () )
         ( setUpControlBarEvents () )
       )
    )
    ( alertUserSystemReady () )
  )
)

I guess it could be a graph tool (trees being a subset of graphs, of course), but I don't imagine a graph tool would have the ability to automagically put things on the right level. What I like about organizing this data as a tree is that there are distinct levels, which helps me visualize what's going on.

I've tried yEd and LucidChart, but both were too manual for me. Since the tree is going to go pretty deep, I need something that can automatically restructure with the tree data. I also tried GraphViz, but couldn't get it working (I'm on Windows and didn't know what to do after the install).

Google isn't helping much on the tree editor end - it's giving me pages like http://bioinfo.unice.fr/biodiv/Tree_editors.html which just have way too many to choose from. In this case I think using others' experience would be better, so I came here.

So, anybody know of any tools that would get me closer to my goal? Thanks!

share|improve this question

closed as off-topic by gnat, MichaelT, GlenH7, Bart van Ingen Schenau, mattnz Aug 26 '13 at 1:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, GlenH7, Bart van Ingen Schenau, mattnz
If this question can be reworded to fit the rules in the help center, please edit the question.

    
From what I remember, GraphViz is more of a back-end. It takes a formatted text file description of the graph as input and then generates the graph image, but it is not interactive. There are other graphing tools that read/write the GraphViz format and I think that yEd (you already tried it) is one of them. –  FrustratedWithFormsDesigner Feb 24 '12 at 19:17
add comment

2 Answers 2

up vote 3 down vote accepted

I've used Graphviz a number of times for stuff like this (on Linux and on Windows, too). Something like this example seems like it would work for your needs. It installs as a set of command-line tools, but the main one you want to worry about is called 'dot' which is for drawing directed graphs. It will lay your nodes out with a layer for each level. You don't need to worry about format, as it will figure that out for you, keeping nodes layed out in straight lines on the same level in the tree. It tries to keep lines from crossing, or nodes from overlapping, and does a pretty good job in my experience.

It's a pretty simple language; all you'll need to do is write up the file to describe your graph using DOT, and then run the dot command over that file to generate an image.

Something like this should get you started:

digraph G {
    initAll -> initDisplay;
    initAll -> initControlBar;
        initControlBar -> addButtons;
        initControlBar -> setUpControlBarEvents;
    initAll -> alertUserSystemReady;
}

Write that in a text file called graph.dot and then run:

dot -Tpng graph.dot -o graph.png

You should get this result: resulting graph

share|improve this answer
    
Awesome! Thank you very much. –  S-OBrien Feb 24 '12 at 21:03
add comment

Did you consider 'mindmapping' software? 'Mind maps' are basically just trees. Try FreeMind or something like that.

Mind maps are a special type of representing trees, intended to capture various aspects and details of arbitrary concepts. For me it worked well to describe requirements / features of software I develop.

Editors usually allow to expand / contract branches, add color, icons, etc to branches and nodes, etc.

A typical mind map:

mind map

(from http://creativejourneyman.com/basic-website-planning/)

Usually mind maps are used at a bit higher level than your example, but might work in your case, too.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.