Visualize code dependencies between files in your C/C++ projects.
CodeViz is a simple, cross-platform, python3 script that creates a code dependency graph using source and header files.
It works by first creating a dot file. The dot file is then then passed into graphviz, which is a supporting program that will automagically create a map of your code.
You will need to have a python3 interpreter installed to run the script.
Also, the script itself requires graphviz installed. Follow the install instructions from the graphviz website for your platform:
Once installed, make sure that you have these tools in your environment path.
The image below shows the result of generating the visual code map for the original git source at hash e83c516.
Run codeviz.py
inside of your source directory. By default, it will only use
the source/header files in the working directory (system header files such as
stdio.h are ignored).
codeviz.py
You may also search for source/header files recursively as so
codeviz.py -r
If you want a black and white version of the generated dependency graph
codeviz.py -n
What if you want a black and white version of the generated dependency graph, AND you would like to ignore files that are not including any other header in your source files?
codeviz.py -m
You can specify the name of an output file. The extension will be passed into graphviz to generate the appropriate file.
codeviz.py -o jpeg-file.jpg
codeviz.py -o postscript-file.ps
codeviz.py -o png-file.png
See here for a complete list of supported output formats
Finally, can you exclude certain files and directories from being used.
codeviz.py -r --exclude=unit_tests/* --exclude=test*.[ch] # exclude tests