This directory contains the implementation and resources for analysing code graphs using graph algorithms within the Code Graph Analysis Pipeline. It follows the vertical-slice domain pattern: all Cypher queries, shell scripts, and report templates needed for this analysis live here.
This domain covers three related analysis areas:
- Centrality: Which nodes (packages, types, artifacts, TypeScript modules) are most influential in the dependency graph — PageRank, ArticleRank, Betweenness, Harmonic, Closeness, HITS, Bridges, CELF.
- Community Detection: How code units cluster into communities — Louvain, Leiden, Strongly Connected Components, Weakly Connected Components, Label Propagation, K-Core, Approximate Maximum k-cut, HDBSCAN, Local Clustering Coefficient.
- Similarity: Which code units share the most common dependencies — Jaccard Node Similarity.
The goal is to run the majority of graph algorithms provided by the Neo4j Graph Data Science (GDS) library and compare their results to get a basis for exploration and experimentation.
These algorithms are not included:
- Path-Finding algorithms: see internal-dependencies
- Node Embedding algorithms: see node-embeddings
The following scripts are discovered and invoked automatically by the central compilation scripts in scripts/reports/compilations/. They are found by filename pattern.
- centralityCsv.sh: Entry point for centrality CSV reports. Discovered by
CsvReports.sh(*Csv.shpattern). - communityCsv.sh: Entry point for community detection CSV reports. Discovered by
CsvReports.sh(*Csv.shpattern). - similarityCsv.sh: Entry point for similarity CSV reports. Discovered by
CsvReports.sh(*Csv.shpattern). - graphAlgorithmsMarkdown.sh: Entry point for the Markdown summary report. Discovered by
MarkdownReports.sh(*Markdown.shpattern).
domains/graph-algorithms/
├── README.md # This file
├── PREREQUISITES.md # Detailed prerequisite documentation
├── COPIED_FILES.md # Original → copy mapping for deprecation follow-up
├── centralityCsv.sh # Entry point: centrality CSV reports
├── communityCsv.sh # Entry point: community detection CSV reports
├── similarityCsv.sh # Entry point: similarity CSV reports
├── graphAlgorithmsMarkdown.sh # Entry point: Markdown summary
├── queries/
│ ├── centrality/ # 43 Cypher queries (copied from cypher/Centrality/)
│ ├── community-detection/ # 64 Cypher queries (copied from cypher/Community_Detection/)
│ ├── similarity/ # 10 Cypher queries (copied from cypher/Similarity/)
│ └── statistics/ # 8 summary Cypher queries for the Markdown report
└── summary/
├── graphAlgorithmsSummary.sh # Markdown assembly logic
├── report.template.md # Main report template
└── report_no_graph_data.template.md # Fallback when no data is present
See PREREQUISITES.md for full details. Key requirements:
- Neo4j running with the Graph Data Science (GDS) plugin installed
DEPENDS_ONrelationships with weight properties fromcypher/Dependency_Enrichment/- Dependencies Projection functions from
cypher/Dependencies_Projection/andscripts/projectionFunctions.sh
centralityCsv.sh— runs centrality algorithms, writes node properties and CSV filescommunityCsv.sh— runs community detection algorithms, writes node properties and CSV filessimilarityCsv.sh— runs similarity algorithm, writesSIMILARrelationships and CSV filesgraphAlgorithmsMarkdown.sh— assembles the final Markdown report from statistics queries
All output goes into reports/graph-algorithms/:
reports/graph-algorithms/<NodeType>/centrality/— centrality scores per node type and algorithm (e.g., Java_Package, Java_Type, Typescript_Module)reports/graph-algorithms/<NodeType>/communities/— community assignments per node type and algorithmreports/graph-algorithms/<NodeType>/similarity/— top similar node pairs per node typereports/graph-algorithms/— assembled Markdown report (graph_algorithms_report.md)