graphdb container runs Neo4j, which stores code structure as nodes and relationships.
Why a Graph Database?
Code structure is inherently a graph:- Classes depend on other classes
- Methods call other methods
- Files import other files
- Namespaces contain types
Key Concepts
Relational vs Graph
Find all classes that depend on UserService: SQL requires multiple joins and gets complex fast. Graph queries handle arbitrary depth in a single line:Current Implementation
| Database | Status |
|---|---|
| Neo4j | Supported (default) |
| Memgraph | Planned |
| Amazon Neptune | Possible |
| ArangoDB | Possible |
IGraphStorage port abstracts the database.
Database-Agnostic Design
The core doesn’t know which database it’s using:- Run CodeGraph with different databases
- Tests can use in-memory implementation
- Future databases easy to add
Performance
Graph databases excel at:- Traversals: Following relationships is O(1) per hop
- Pattern matching: Finding structural patterns
- Variable-depth queries: “Find all transitive dependencies”
- Aggregations: Full graph scans
- Simple lookups: Overkill for basic queries