Abstract
Since the conventional hierarchical layout algorithm has the disadvantage of wiring chaos in large programs, this paper proposes a hierarchical orderly layout algorithm based on channel points. By dynamically adjusting the number of channel points on each node according to program size, the algorithm solves overlap problems during wiring. Combined with a generalized tensor balance approach to reduce crossings and realize an aesthetic layout, the algorithm provides a routing strategy based on the relative positional relationship between calling nodes. Experimental results demonstrate that the algorithm effectively reduces crossings, improves layout clarity, and maintains high efficiency.
Introduction
Visualizing large-scale software architectures, such as module call graphs and class hierarchies, is critical for system maintenance and debugging. The industry standard for hierarchical graphs is the Sugiyama layout algorithm. However, as software complexity grows, the Sugiyama method often results in "wiring chaos"—a state where edges overlap excessively and cluster into unreadable patterns. While "virtual nodes" are often used to manage long-distance connections, they introduce significant computational overhead and frequently lead to unbalanced diagrams. This paper introduces an enhanced approach that replaces messy routing with structured "channel points."
The Proposed Algorithm
The proposed method builds upon the Sugiyama framework but introduces a more structured, four-step process to ensure orderliness and symmetry.
- Node Level Specification: Nodes are assigned to layers based on their hierarchical call relationships.
- Node Sorting (Generalized Tensor Balance): To improve symmetry, nodes with high correlation are placed toward the center of a layer, while less-related nodes are moved toward the edges.
- Channel Point Specification: Instead of arbitrary connection points, the algorithm defines specific "ports" or channel points on each node.
- Physical Coordinate Calculation & Routing: A specific routing logic assigns lines to idle channel points based on the node's position relative to the layer center.
Dynamic Channel Point Scaling
The core innovation of this research is the dynamic adjustment of channel points based on the total number of nodes in the program. A "one size fits all" approach to node ports fails in high-density graphs. By scaling the available "bandwidth" for connections, the algorithm ensures that even complex nodes can be wired without overlap.
As shown in Figure 2, the number of points increases with program size:
- Small programs (<120 nodes): 5 points per node.
- Medium programs (120–500 nodes): 8 points per node.
- Large programs (>500 nodes): 15 points per node.
Key Insights and Results
By moving beyond the traditional reliance on virtual nodes, the algorithm achieves a much "lighter" and more efficient layout process. The use of a "tensor balance" approach ensures that the resulting graphs follow aesthetic standards of symmetry, which is vital for human understandability.
Qualitative comparisons show that in high-complexity scenarios—such as a node with 13 distinct call relationships—the proposed layout prevents the "spaghetti" effect. By assigning lines to specific idle ("i") or occupied ("u") channel points based on whether a node sits to the left or right of the layer center, the algorithm ensures that cross-layer connections do not tangle or cross the entire width of the graph unnecessarily.
Conclusion and Future Work
The hierarchical orderly layout algorithm based on channel points offers a significant improvement in the visualization of large software systems. It reduces the overhead of virtual node generation and provides a clearer, more symmetrical output. Future work should focus on formal computational complexity analysis and user studies to quantify the speed at which developers can navigate these improved diagrams compared to traditional layout engines.
Summary updated