Skip to content
SciTools Blog
Menu
  • Home
  • Blog
  • Support
  • Contact
  • Login
  • Pricing
  • Free Trial
Menu
A tangled mess of colorful thin wires

Dependency Cycles

Posted on November 30, 2026

Abstract: Four new plugins make finding and fixing file dependency cycles even easier. “Dependency Cycles” architecture identifies them. “Architecture Overlap” graph and report makes it easy to compare any two architectures and can be used to see where “Dependency Cycles” are in “Directory Structure”. Finally “Dependency Hubs” identifies key files contributing to the cycle.

You set out to change one file. Then that change needs another change somewhere else, and that one needs another, until the “quick fix” touches half the codebase. The culprit is often a dependency cycle: files that all depend on each other, so none of them can change alone. On Windows, cycles can also make linking take forever.

Understand is great for finding dependencies. These new plugins go further: they find the cycles, show where they live in your code, and point to the files to start with when breaking them up.

Finding Dependencies

The first question is what dependency cycles to find. Dependency violations can find circular dependencies between architectures and even recommend ways to break the cycle. Automatic architectures like CMake or Visual Studio Structure make it straightforward to find dependencies between build system components. 

So, for this article, let’s focus on file dependencies. It turns out there’s already an automatic architecture for finding file dependencies called Visibility Matrix Cores, based on network analysis. Dependency Cycles builds on it with a few changes:

  1. A name that says what it finds
  2. Cycles named after their hub files, so they’re easier to understand and track over time
  3. Header and code files grouped together

So, introducing the “Dependency Cycles” automatic architecture. For cycle names, let’s use the “hub” files (more on that below). Finally, let’s give the option to combine companion files (on by default). So, for C++, a header and code file are considered together. The algorithm for it works even if the project has a setup with header and code files in different directories. 

For the CMake Sample Project, it finds 13 cycles. I’ll show the architecture as a “File Metrics Chart” because it’s prettier than a wall of text and more informative. From the image, the biggest cycle is “cmMakeFile”, followed by “cmCTest”. You can see the companion file clusters like “cmTarget” and “cmake” inside cmMakeFile. 

File Metrics Chart of the Dependency Cycles architecture for the CMake sample project, with cmMakeFile as the largest cycle

Cycle Severity

The first thing I want to know about the cycle is how big it is. The chart gives me a hint which are the biggest. To get more information, I can use some existing metrics. Let’s look at the biggest cycle “cmMakeFile”.

Metrics for the cmMakeFile cycle, including Files, Children, and Entities counts

From Contents, I can see that there are 559 Files involved in the cycle. But, because Dependency Cycles groups by companion files, the number of Children also matters. The cycle is between 272 companion file groups and the 15 Entities that belong directly to the architecture, for a total cycle size of 287. 

Cycle Location

So far, only the companion file grouping and cycle names are new to this version of Understand.

Here’s where things get really cool. Suppose I want to know what’s in this cycle. I don’t really want to look through 559 files, or even the smaller 287 direct children and entities in the architecture. I want a summary view, like where this cycle is in “Directory Structure.”

Introducing “Architecture Overlap” plugins. I’ll show the chart first. Here is the “Dependency Cycles” architecture overlaid on “Directory Structure”: 

Architecture Overlap chart showing the Dependency Cycles architecture overlaid on Directory Structure

I love this chart! I can immediately see that most of the cmMakeFile cycle (light blue) are in files directly belonging to source. The other smaller cycles are mostly confined to specific libraries. The second biggest cycle, cmCTest, is mostly in cTest, but with a few files in Source.

If I need more concrete numbers, I can open the “Architecture Overlap” report. It starts with the same chart and then gives me tables of details. Here’s the beginning of the first table: 

First table of the Architecture Overlap report, showing which Directory Structure folders each cycle falls in

As the picture showed, cmMakeFile is completely in the direct children of Source. cmCTest actually crosses three folders, but is mostly in cmCTest. Cycles that cross boundaries seem especially concerning so I’ll click on “cmCTest” to get more detail. I’ll skip to the second table in the report to see which architectures in Directory Structure contain parts of the cmCTest cycle:

Architecture Overlap report table listing the three folders that contain the cmCTest cycle

The three folders that contain cmCTest cycle are “Source/CTest”, “Source” and “Source/Lexer Parser”.

More Fun Overlaps

Since I really love the new architecture overlap plugins, let’s do a few more use cases. First, CMake’s “Source” directory has 773 direct files, so Directory Structure doesn’t break the code down much. The custom Functional Decomposition architecture in the sample project gives a clearer picture. Cycle colors are the same so I’ll skip the legend in the screenshot. Now I can see that even though cmMakeFile cycle is all within Source, it crosses a lot of functional groups. 

Architecture Overlap chart showing Dependency Cycles overlaid on the Functional Decomposition architecture

I don’t have to limit my overlap to cycles. For instance, what if I want to know what parts of the code a specific Git Author works on. I’ll make the automatic “Git Author” architecture to see the last author to touch each piece of code and overlap that on “Directory Structure”. CMake is clearly being taken over by a robot. 

Architecture Overlap chart showing the Git Author architecture overlaid on Directory Structure

Dependency Hubs

Alright, back to cycles. I know cmMakeFile is my biggest cycle with 287 members (559 files) and that it’s entirely inside files inside the “Source” folder, and covers many parts of the “Functional Decomposition” architecture. What if I wanted to break it up?

I’ll start the same way Dependency Cycles decided the cycle name. I want to find the hub(s) of the cycle.  

The Dependency Hubs algorithm was initially developed for AI. Specifically, architecture overviews need to summarize potentially hundreds of files, but for speed we try to do it in a single prompt. AI tends to be more accurate looking directly at source code, so after listing the architecture contents, the overview prompt includes source code from key files. But how to identify the file most likely to help the AI determine the purpose of the code?

Testing showed that the file with the most incoming dependencies from its peer files was the most useful for AI to read. Like Dependency Cycles, companion files are grouped before finding incoming dependencies. From within companion files, header files are preferred over code files, and shorter files are preferred over longer ones. 

Now this algorithm exists in Python and is used by Dependency Cycles to name cycles. But there’s also an interactive report “Dependency Hubs” to show the raw results. Let’s run it on cmMakeFile cycle.

Dependency Hubs report for the cmMakeFile cycle, ranking files by incoming dependencies from peer files

From the report, I have two main directions I could go to break up this cycle. I could try to remove outgoing dependencies from the hub file(s) to remove them from the cycle. Or I could try to remove incoming dependencies from the files with the least incoming dependencies to remove them from the cycle.  

Conclusion

The plugins get me a lot more information than I had before. I now know where the cycles are and have an idea which files I could start with. There’s more we could build from here. For instance, it would be nice to get the same dependency violations view of files that exists for architectures so I could see recommended edges to remove. A view similar to the “Architecture Overlap” graph but over “File Dependencies” instead of a treemap also seems useful to see where cycles are. Or, circling back to Git, maybe certain authors should be skippable so that automated commits don’t obscure useful information. With so many possibilities, we need your feedback to choose. What matters most to you?

Learn more about Understand's Features

  • Dependency Graph
    View Dependency Graphs
  • Comply with Standards
  • View Useful Metrics
  • Team Annotations
  • Browse Depenedencies
  • Edit and Refactor

Related

  • AI
  • Annotations
  • API
  • Architectures
  • Business
  • Code Comparison
  • Code Comprehension
  • Code Navigation
  • Code Visualization
  • Coding Standards
  • Dependencies
  • Developer Notes
  • DevOps
  • Getting Started
  • Legacy Code
  • Licensing
  • Metrics
  • Platform
  • Plugins
  • Power User Tips
  • Programming Practices
  • Useful Scripts
  • User Stories
  • November 2026
  • October 2026
  • September 2026
  • August 2026
  • June 2026
  • May 2026
  • December 2025
  • November 2025
  • August 2025
  • June 2025
  • May 2025
  • January 2025
  • December 2024
  • November 2024
  • August 2024
  • June 2024
  • May 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • June 2023
  • April 2023
  • January 2023
  • December 2022
  • November 2022
  • September 2022
  • August 2022
  • May 2022
  • April 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

©2026 SciTools Blog | Design: Newspaperly WordPress Theme