---
title: Repository Structural Semantic Graph (RSSG)
url: https://www.emergentmind.com/topics/repository-structural-semantic-graph-rssg
type: topic
---

# Repository Structural Semantic Graph (RSSG)

Searching arXiv for recent papers on repository structural semantic graphs and related repository graph representations.
Repository Structural Semantic Graph (RSSG) is a repository-level graph representation that unifies structural program relations with semantic annotations, embeddings, or higher-level abstractions so that codebases can be queried, ranked, traversed, summarized, or consumed by language models as structured context rather than as flat text. Across recent work, RSSG is instantiated as a heterogeneous, directed, often typed and attributed graph over entities such as repositories, projects, directories, files, classes, functions, statements, and domain entities, with edges capturing containment, imports, calls, inheritance, data flow, and repository-artifact links. The term is used explicitly in some systems and as a direct mapping for related constructs such as semantic code graphs, repository planning graphs, repository-aware knowledge graphs, and multi-view code graphs [2601.10773], [2605.16352], [2602.02084], [2507.14791].

## 1. Definition and conceptual scope

RSSG denotes a graph that combines repository structure with semantic information at one or more granularities. In one explicit formulation, the repository is represented as a typed, attributed, directed multigraph $G = (V, E, X)$ whose nodes include directories, files, classes, and functions, and whose edges encode relations such as `contains`, `imports`, `invokes`, `inheritance`, and cross-artifact links [2605.16352]. In another formulation specialized to multi-repository systems, the graph is defined as $G = (V, E, A)$ with node types $\{System, Project, Code, Entity\}$ and edge labels partitioned into structural relations $\{\text{CONTAINS}, \text{DEPENDS\_ON}, \text{CALLS}, \text{IMPLEMENTS}\}$ and semantic relations $\{\text{CREATE}, \text{PRODUCE}, \text{CONFIGURE}, \text{REPRESENTS}, \text{RELATES\_TO}\}$ [2601.10773]. RepoScope likewise defines RSSG as a multi-view heterogeneous directed graph over `Class`, `Function`, and `Attribute` entities with structural/type, call, and import relations [2507.14791].

The structural component typically includes hierarchy and static dependency information: repository or package containment, import relations, call graphs, inheritance, ownership, and symbol visibility [2505.16901], [2403.06095], [2505.14394]. The semantic component varies by system. It may consist of node text attributes such as code, comments, docstrings, and signatures [2505.16901]; natural-language summaries and vector embeddings [2601.10773], [2510.08876]; lifted verb–object functionality features attached to nodes [2602.02084]; or domain entities and workflow-like action edges that link code to concepts such as `Order`, `User`, or `Payment` [2601.10773].

A recurring distinction in the literature is between repository-local structural graphs and richer repository structural semantic graphs. Structural-only graphs capture static dependencies but often do not expose system-wide workflows, domain logic, or higher-level intent [2601.10773]. RSSG formulations attempt to bridge that gap by adding semantic descriptions, learned embeddings, artifact links, domain abstractions, or fine-grained program dependencies, depending on the target task.

## 2. Node and edge taxonomies

The node set of an RSSG is heterogeneous and task-dependent. A minimal repository-local schema in LARGER uses directories, files, classes, and functions, each carrying textual attributes such as file path, code block, or doc string [2605.16352]. CGM expands this to `REPO`, `PACKAGE`, `FILE`, `TEXTFILE`, `CLASS`, `FUNCTION`, and `ATTRIBUTE` [2505.16901]. RepoHyper’s Repo-level Semantic Graph uses `Function/Method`, `Class`, and `Script` nodes, with script nodes representing file contents not captured as functions or classes [2403.06095]. LogicLens adds `System`, `Project`, `Code`, and `Entity` nodes for cross-repository reasoning [2601.10773]. ARISE extends structural nodes down to statement level, with node types `{Directory, Module, Class, Function, Method, Statement}` [2605.03117]. RepoSPD’s repository-level graph for patch detection goes further to statement, basic block, AST, and token granularity, with version labels $\{pre, post, common\}$ attached to merged nodes [2412.08068].

Edge vocabularies are equally varied but cluster into a few stable families. Structural edges include containment, imports, call or invoke relations, inheritance, ownership, encapsulation, and file-to-symbol links [2605.16352], [2403.06095], [2505.16901]. Semantic or higher-level relations include code-to-domain action links such as `CREATE`, `PRODUCE`, `CONFIGURE`, and `REPRESENTS` [2601.10773], as well as `has_description` links to semantic description nodes in graph-based code generation systems [2505.14394]. Some systems also add repository-artifact relations, for example between issues, pull requests, files, classes, and functions via `mentions` or `references` edges [2503.21710]. Program-semantics variants incorporate statement-level `DataflowDefUse` and `DataflowUseDef` edges [2605.03117], or AST, CFG, CDG, DDG, and def-use relations in repository patch graphs [2412.08068].

The following table summarizes recurrent node and edge categories as they are instantiated in the cited systems.

| Aspect | Examples of nodes | Examples of edges |
|---|---|---|
| Repository hierarchy | `REPO`, `PACKAGE`, `FILE`, `TEXTFILE`; `System`, `Project` | `contains`, `CONTAINS` |
| Code symbols | `CLASS`, `FUNCTION`, `METHOD`, `ATTRIBUTE`, `Code`, `Script` | `calls`, `invokes`, `CALLS`, `imports`, `DEPENDS_ON`, `IMPLEMENTS`, `inheritance`, `Inherits` |
| Fine-grained program units | `Statement`, `V_stmt`, `V_ast`, `V_bb` | `DataflowDefUse`, `DataflowUseDef`, `R_cfg`, `R_cdg`, `R_ddg`, `R_ast_parent` |
| Semantic abstractions | `Entity`, `Description`, high-level architectural nodes | `CREATE`, `PRODUCE`, `CONFIGURE`, `REPRESENTS`, `RELATES_TO`, `has_description` |
| Repository artifacts | `Issue`, `PR`, optionally `Commit`, `Contributor` | `mentions`, `references`, optional `modifies`, `authored_by` |

This taxonomy suggests that RSSG is less a single fixed schema than a family of related graph formalisms. A plausible implication is that the graph should be matched to the downstream task: issue localization benefits from artifact links and shortest paths, code completion benefits from symbol- and call-centric structure, and repair or debugging benefits from finer data-flow or temporal structure.

## 3. Construction pipelines and semantic enrichment

Most RSSG pipelines begin with static parsing. Tree-sitter is a common choice for extracting classes, structs, and functions and for building containment and dependency edges across languages such as Java, Python, Go, and TypeScript [2601.10773]. RepoHyper similarly uses Tree-sitter and Python’s AST, plus PyCG for call-graph construction in Python repositories [2403.06095]. CGM describes a generic pipeline that walks the repository, builds hierarchical nodes, parses ASTs for classes, functions, and attributes, resolves imports and calls, strips child spans from parent nodes to reduce textual duplication, and then chunks long node text into units of up to 512 tokens [2505.16901].

Semantic enrichment is usually layered on top of this structural pass. LogicLens uses hierarchical prompting to generate concise three-sentence summaries for code nodes, aggregate them to project-level summaries, and synthesize system-level summaries; it then uses specialized prompts to extract domain entities and action relations between code and entities [2601.10773]. Other systems attach docstrings, comments, and LLM-generated descriptions directly to code entities, often as separate description nodes or as node attributes with associated embeddings [2505.14394], [2510.08876]. RPG-Encoder formalizes semantic lifting by attaching concise verb–object features $f$ to nodes and organizing them into a feature hierarchy over high-level and low-level repository nodes [2602.02084].

Several papers treat embeddings as a core RSSG attribute rather than as a separate retrieval artifact. LogicLens defines node embeddings $f: V \to \mathbb{R}^d$ and query embeddings $g(q) \in \mathbb{R}^d$ and uses cosine similarity
$$
s(u, v) = \frac{f(u) \cdot f(v)}{\|f(u)\| \|f(v)\|}
$$
for semantic search over nodes [2601.10773]. LARGER attaches textual attributes $X(v)$ to graph nodes and uses lexical search to find anchors, then expands locally in the graph [2605.16352]. CGM computes CodeT5+-based embeddings for node text chunks and maps them into the decoder input space through a two-layer MLP adapter [2505.16901].

Incrementality is addressed unevenly across the literature. Some systems operate on static repository snapshots, especially in benchmark settings [2505.14394], [2403.06095]. Others provide explicit update mechanisms. LARGER aligns a cached graph $G_{c-1}$ to a new commit via the diff,
$$
G_c = A(G_{c-1}, diff(c-1, c)),
$$
with cost $O(|\Delta(c)|)$, and reports per-commit alignment in milliseconds [2605.16352]. RPG-Encoder similarly performs local updates whose cost scales with the change set size and hierarchy depth, reducing token budget for maintenance from approximately $14.7\text{M}$ to $633\text{K}$, a 95.7% reduction [2602.02084].

## 4. Retrieval, traversal, and query semantics

RSSG is primarily useful because it supports structure-aware localization and traversal. Several systems operationalize this through graph-native scoring and bounded expansion. LogicLens defines a base score
$$
S(q, v) = \alpha s(g(q), f(v)) + \beta C(v) + \gamma N(v),
$$
where $C(v)$ encodes node-class priors and $N(v)$ neighborhood strength, then extracts induced subgraphs around top-ranked nodes [2601.10773]. LARGER casts repository localization as selecting an active subgraph driven by lexical anchors aligned to graph nodes:
$$
a_t = \pi(q, C_{t-1}), \qquad M_t = align(\Omega_{lex}(a_t)),
$$
followed by confidence-filtered local expansion and bounded-context accumulation across interaction steps [2605.16352]. Its theoretical analysis states recall dominance over a purely lexical loop and derives a bounded per-step augmentation cost $\Delta = m \cdot k \cdot L_{node}^{max}$ [2605.16352].

Repository-level completion systems often use a search–expand–refine paradigm. RepoHyper first retrieves top-$K$ nearest nodes by embedding similarity, then expands by BFS or by frequent structural path types, and finally re-ranks candidates using GraphSAGE-based link prediction between a query node and expanded graph nodes [2403.06095]. RepoScope combines four views—callers, predicted call chains, similar functions, and similar code fragments—and uses a call-chain prediction procedure over structural/type edges to infer likely callees in the yet-unimplemented target function [2507.14791]. Its entity scoring function is
$$
S_e = \alpha_1 \cdot sim(V_f, V_e) + \alpha_2 \cdot \phi\!\left(\sum_{(h,r,t)\in G,\; r\in \mathcal{R}_C,\; h\in C_f \setminus \{f\},\; t\in C_e} \alpha_3 w_r\right),
$$
with $\phi(x)=\log_2(x+1)$ in experiments [2507.14791].

Issue-resolution and repair systems emphasize multi-hop path reasoning. KGCompass ranks candidate functions by
$$
S(f) = \beta^{l(f)} \cdot \left(\alpha \cdot s_{cos}(i, f) + (1-\alpha) \cdot lev(t_i, t_f)\right),
$$
where $l(f)$ is the weighted shortest-path length from issue node $i$ to function $f$, with $\alpha = 0.3$ and $\beta = 0.6$ [2503.21710]. ARISE exposes slicing as a first-class graph query over statement-level data-flow edges, allowing backward and forward traversal within a function boundary from a seed variable and line [2605.03117]. DUALVIEW generalizes traversal across four view-specific graphs—module coupling, function call, class hierarchy, and program dependence—and composes them into a multiplex RSSG with a supra-adjacency
$$
\bar{A} = A + \alpha_{proj} \cdot A_{proj},
$$
enabling cross-view path composition [2607.01929].

These formulations share a common premise: retrieval quality depends not only on node-text similarity but also on the graph’s typed local neighborhood, path structure, and interaction budget. This suggests that RSSG functions as both an indexing structure and a reasoning substrate.

## 5. Task-specific variants and applications

RSSG has been adapted to at least four distinct task families.

For repository-level code completion and generation, RSSG serves as a retrieval substrate that recovers cross-file context unavailable to flat similarity search. RepoHyper reports large gains over similarity-only retrieval in RepoBench, with retrieval accuracy improving by an average of 49% across subsets [2403.06095]. RepoScope reports improvements on CoderEval and DevEval, reaching a 36.35% relative improvement in pass@1 on DevEval with Claude-3.5-Haiku and a 17.15% relative improvement on CoderEval with DeepSeek-V3 [2507.14791]. GRACE uses a multi-level code graph with AST, CFG, DFG, type dependency, call, inheritance, and repository structure, and reports gains of +8.19% EM and +7.51% ES over the strongest graph-based RAG baselines using DeepSeek-V3 [2509.05980]. CGM integrates repository graph structure directly into decoder attention and achieves a 43.00% resolution rate on SWE-bench Lite with Qwen2.5-72B, surpassing the previous best open-source model-based method by 12.33% [2505.16901].

For localization and navigation in coding agents, graph representations support file- and function-level search. LARGER improves file-level Acc@5 on LocBench by +13.9 points with tuned hyperparameters and +11.8 with fixed hyperparameters over the strongest baseline, while also improving MuLocBench, SWE-Atlas Test Writing, and SWE-Atlas Codebase QA [2605.16352]. RPG-Encoder reaches 93.7% Acc@5 at function level on SWE-bench Verified and exceeds the best baseline by over 10% on SWE-bench Live Lite [2602.02084]. DUALVIEW improves issue-resolution performance across multiple agents and model families by externalizing structure in persistent visual and textual graph slices [2607.01929].

For debugging, fault localization, and automated repair, RSSG variants tend to add finer dependencies or artifact links. LogicLens reports emergent capabilities including impact analysis, symptom-based debugging, and log-fragment debugging arising from its semantic multi-repository graph [2601.10773]. ARISE improves Function Recall@1 by 17.0 points and Line Recall@1 by 15.0 points over the SWE-agent baseline, and reaches 22.0% Pass@1 on SWE-bench Lite, a 4.7 percentage-point improvement [2605.03117]. KGCompass achieves 45.67% repair performance and 51.33% function-level localization on SWE-Bench-Lite at approximately $0.20$ per repair, and reports that 69.7% of successfully localized bugs require multi-hop knowledge-graph traversals [2503.21710].

For security analysis and patch detection, the graph often becomes temporal and lower-level. RepoSPD constructs a repository-level graph by merging pre-patch and post-patch code property graphs and augmenting them with repository call edges, then fuses graph and sequence branches for classification [2412.08068]. On SPI-DB* and PatchDB*, RepoSPD improves accuracy by 11.90% and 3.10% over the best baselines, respectively [2412.08068].

## 6. Evaluation patterns, strengths, and limitations

Evaluation results across the literature converge on a few robust patterns. First, graph-aware retrieval consistently outperforms lexical-only or vector-only retrieval. LARGER’s ablations show MuLocBench Acc@5 dropping from 55.7 to 48.2 without graph expansion and to 53.1 without confidence scoring [2605.16352]. RepoHyper’s ablations show that pattern-based graph expansion plus a link predictor outperforms kNN-only and cosine-only reranking on RepoBench-R [2403.06095]. LogicLens substantially improves human-rated accuracy and coherence relative to a vector baseline; the baseline has Accuracy High 0 and LogicLens reaches Accuracy High 69.5, while Coherence High rises from 17.39 to 52.2 [2601.10773].

Second, typed relations and local graph neighborhoods appear to be especially valuable when the task depends on non-textual structure. ARISE’s controlled ablation shows that gains come from the data-flow graph rather than merely from exposing a tool schema [2605.03117]. KGCompass finds that multi-hop traversals are necessary in 69.7% of successful localizations [2503.21710]. RepoScope’s call chain prediction improves predicted callee F1 from 0.4352 for a similarity-only baseline to 0.603 [2507.14791].

Third, graph representations introduce their own failure modes. Static analysis misses dynamic dispatch, reflection, macros, or runtime imports [2505.16901], [2605.03117], [2510.08876]. LLM-inferred semantics can be noisy or stale as repositories evolve [2601.10773]. Dense neighborhoods can cause over-expansion unless controlled by confidence thresholds, node budgets, or summarization nodes [2605.16352], [2607.01929]. Cross-repository version alignment, privacy, and access control remain non-trivial for multi-repository graphs [2601.10773].

A frequent misconception is that a structural graph alone suffices to solve repository reasoning. The surveyed systems do not support that conclusion. Structural-only graphs help with dependency recovery, but several papers argue that they struggle with domain logic, workflow reconstruction, or issue-to-code grounding unless augmented with semantic signals, artifact links, or finer def-use structure [2601.10773], [2503.21710], [2605.03117]. A second misconception is that semantic retrieval makes graph structure unnecessary. LARGER, RepoHyper, RepoScope, and GRACE all report that semantic similarity alone misses crucial dependencies, whereas hybrid graph-aware retrieval improves localization or generation [2605.16352], [2403.06095], [2507.14791], [2509.05980].

## 7. Positioning and prospective directions

RSSG sits at the intersection of program analysis, software repository mining, graph representation learning, and LLM-based software engineering. Compared with ASTs, it broadens scope from file-local syntax to repository-level multi-relational structure [2505.16901], [2503.21710]. Compared with call graphs or dependency graphs, it adds semantic text, hierarchy, and sometimes artifact or domain links [2505.16901], [2503.21710]. Compared with code property graphs, it is often lighter-weight and more retrieval-oriented, though some variants such as RepoSPD adopt CPG-like lower-level structure [2412.08068]. Compared with flat vector indexes, it supports multi-hop reasoning, induced subgraph extraction, and path-aware explanation [2601.10773], [2605.16352].

Several future directions recur across papers. One is richer dynamic information: runtime traces, logs, telemetry, dynamic call graphs, test coverage overlays, and empirical usage statistics are repeatedly proposed as complements to static edges [2601.10773], [2510.08876], [2607.01929]. Another is broader schema coverage, especially tests, configuration files, API specifications, CI/CD artifacts, deployment descriptors, and build metadata [2601.10773], [2605.16352], [2602.02084]. A third is cross-repository and temporal modeling, including commit co-change graphs, version alignment, and longitudinal graph evolution [2601.10773], [2602.02084], [2607.01929].

There is also a methodological split between graph-as-retrieval-substrate and graph-as-model-input. LARGER, RepoScope, KGCompass, and LogicLens primarily use the graph to localize or assemble context [2605.16352], [2507.14791], [2503.21710], [2601.10773]. CGM integrates graph structure directly into the decoder attention mask [2505.16901]. DUALVIEW externalizes the graph visually as a persistent reasoning artifact for agents [2607.01929]. RPG-Encoder treats the graph as a bidirectional repository representation that closes the loop between comprehension and generation [2602.02084]. This suggests that RSSG is evolving from a retrieval-only abstraction into a general interface layer between repository state, software analysis, and language-model reasoning.

In that broader sense, RSSG can be understood as a unifying abstraction for repository-aware software intelligence: a graph whose nodes ground code and artifacts, whose edges expose structural and semantic dependency, and whose attributes make those relations searchable, rankable, traversable, and, increasingly, directly consumable by agents and neural models.

Source: https://www.emergentmind.com/topics/repository-structural-semantic-graph-rssg