What it is...

codegraph is a tool for monitoring the functional dependencies within C, Fortran, PHP- and Perl-libraries. See the project page or the gem repository for updates.

Screenshot of example files

This is the output of codegraph -F "../examples/*.php" -p example.ps

example pic
Try to find unused functions!


codegraph depends on ruby and 3 extra packages :
- Ruby Graph Library RGL can easily be installed via rubygems: gem install rgl. This should be done automatically by rubygems.
- ctags
- graphviz by AT&T displays the resulting graph


Use codegraph --help or have look into the rdoc documentation. It basically looks like this

Usage: codegraph
                    --help, -h   guess what
                    --file-list, -F ""
                                 fill the graph with every function, 
                                 that has a definiton inside the given files
                    --function, -f ""
                                 take the given func as the root knode

                    --upper-funx, -u ""
                                 scan for all funx, which depends directly or 
                                 indirectly on 
                    --8-funx, -8 ""
                                 scan for all funx, which depends (in)directly
                                  AND which call  
                    --depth, -d 
                                 Set maximal Graph depth
                    --to-ps, -p 
                                 create a postscript file from the graph
                    --to-svg, -S 
                                 create a SVG file from the graph
                    --to-png, -P 
                                 create a PNG file from the graph
                    --to-jpg, -J 
                                 create a JPG file from the graph
                    --to-dot, -D 
                                 creates a .dot-file
                    --to-txt, -T
                                 writes the relations to stdout


codegraph is distributed as a gem. It can be easyly installed via gem install codegraph. Gem dependencies are recognized automatically, but ctags and graphviz have to be installed manually. If codegraph cannot be found after insallation, there might be a problem with the correct setting of the PATH variable. The path where all gem executables a placed can be found out by gem env. Have a look at the output and add the path to your PATH variables. This can be done by editing .profile or the configuration file of your favorite shell.


codegraph is developed under Linux. It should work on any OS with Ruby, ctags and graphviz on it. Windows support is NOT explicitly included. The Ruby Graph Library is pure ruby, whereas inside the codegraph library unix-shell snippets are used. So codegraph should at least work under cygwin. For the graphviz software there exists a special Windows-Installer, but the automatical display function will probably not work. You can generate a .dot and load it into the Windows version of graphviz instead.

Comments on codegraph

are welcome. Send a mail to stark.dreamdetective(-,-)gmail.com