When Does the Dependency Graph Help Code-to-Architecture Mapping?
Authors: Rakhshanda Jabeen, Morgan Ericsson, Jonas Nordqvist, Anna Wingkvist
Organizations: Department of Computer Science, Linnaeus University, Växjö, Sweden · Electrolux Professional AB, Ljungby, Sweden · Department of Mathematics, Linnaeus University, Växjö, Sweden
Architectural technical debt arises when a system's implementation drifts from its inten ded modular decomposition, while the mapping between source files and architectural modu les is missing, incomplete, or costly to maintain manually. We formulate code-to-archite cture mapping as semi-supervised node classification over a directed multi-relational de pendency graph, with files as nodes, typed dependencies as edges, and lexical features d erived from code identifiers and directory layout. Starting from a small labeled sample, an iterative self-training procedure expands the mapping to the remaining files. We com pare a graph convolutional network (GCN), a graph attention network (GAT), and a graph-f ree multi-layer perceptron (MLP), using identical features and training procedures for t he learned models, against a Naive Bayes reference. Across 100 runs on ten open-source J ava and C/C++ systems, all three neural models outperform the reference on both F1 metri cs. GAT achieves the highest averages of system-level median macro and micro F1, at 83.5 and 92.2, respectively, whereas MLP remains competitive or superior on several systems. On Chrome, the largest system with 18,343 files, GAT and GCN exceed MLP by 22 and 19 ma cro-F1 points, respectively, and have substantially fewer persistently misclassified fil es. Connectivity and homophily are associated with where neural message passing helps, w hile multi-relational aggregation outperforms a single merged edge type on every system for both GCN and GAT. A follow-up study finds that several model rankings depend on the training seed, qualifying smaller advantages without removing the large graph benefit ob served on Chrome.
Figures & tables
Figure 1: Overview of the heterogeneous GNN encoder. Node features X (file-path indicator + Word2Vec identifiers) and relation-specific adjacency matrices AR are passed through a relation-specific encoder (GCN or GAT), whose outputs are summed and passed through a non-linear activation function (ReLU) to produce embeddings Z∈R∣F∣×dh , where dh is the number of hidden channels. A linear layer maps Z to per-module logits, and a final softmax produces the class probabilities used for classification and pseudo-labeling.
Figure 2: Distribution of micro F1 (top) and macro F1 (bottom), in points, across 100 runs for each model and system. Boxes show the median and interquartile range; whiskers span the observed range.
Figure 3
Figure 3: Empirical cumulative distribution of per-file misclassification rates across 100 runs, for GAT, GCN, and MLP, on Chrome (left) and pooled across the remaining nine systems (right). The y-axis is the cumulative proportion of test-set files whose misclassification rate is at or below the value on the x-axis, so a curve that rises earlier and higher indicates more reliable per-file decisions. The box plot below each panel shows the median, interquartile range, and full range of the misclassification rate for each model.
Figure 5
Figure 4: Distribution of macro F1, in points, across 100 runs for the multi-relational and uni-relational variants of GAT and GCN. Boxes show the median and interquartile range; whiskers span the observed range.