Interesting Graphs about Your Code

Graphs represent the ultimate abstraction of code – being able to visualize your entire project or zoom in on a specific piece of it in just a glance. You might also find them a useful tool for making your case to management. Understand has many different graphs, and each of these graphs has several different variants. This is not an exhaustive list but demonstrates the most popular graphs in Understand.

Control Flow Graphs

The logic inside this function

Call Trees

What does this function/method call?

Call-By Trees

Showing what calls this function/method

Include Tree

Quickly see what headers this file includes

Butterfly Graph
The butterfly graph shows the most important relationship for the kind of entity you select. For functions and methods, it shows both the call and call by trees. However, for a class, it will show the inheritance tree, and for files, it will show the include tree

Function Butterfly Graph – Both Call and Call-bys
Class Butterfly Graph showing inheritance
File Butterfly Graph showing the inheritance tree for this file

Declaration Graphs

Provide a quick overview of everything defined in that entity

Depends On and Depended on By

Everything this file depends on
And everything that depends on it

Data Members

See the members that belong to this struct

Object References

See everywhere that this object is set and used

UML Class Diagram

A quick overview of a class, those classes it inherits from, or all the classes in your project

UML Sequence Diagrams

Track the data flow and timing for a member object

Overrides

These are all the classes that ClonePage overrides

Dependency Graphs
These project-level interactive graphs let you explore how the different parts of the code rely on each other. This example from git has more details here.

All of the dependencies on list_mergesort

Base and Derived Graphs

Class inheritance

Architecture Graphs
These graphs let you explore how the code files are currently arranged or create new architectures that help better understand how the code is logically put together.

Compare – Butterfly Graph
Compare graphs let you identify how code has changed between two versions of the same project

Blue functions were modified, green added and red removed

Compare – Control Flow

The logical constructs changed between versions are highlighted for easy identification

Project Overview Graphs
These graphs show high-level information to help you get a sense of what’s going on in the project.

  • Line Breakdown shows how many lines of code, comments, inactive, preprocessor, and blank lines your project has
  • Directory Structure sunburst graph shows how much code is in each directory
  • The Most Complex Functions, Most Complex Classes, and Most Complex Files are all based on McCabe Cyclomatic Complexity and let you quickly see the hot spots in your code
  • The Largest Functions, Largest Classes, and Largest Files are based on the line count and also help you focus on important regions

Custom Graphs
If you need something different that we already offer, Understand also allows you to create your own graphs using our APIs.

If you’re interested, you can also read about how we’ve tried to make graphs more interesting.