Graphify is a static analysis tool designed to scan Java projects and generate comprehensive graph-based reports. By leveraging graph theory, Graphify provides insights into the structure, complexity, and modularity of your Java codebase.
Graphify parses Java source code to identify entities (classes, methods, fields) and their inter-relationships (inheritance, calls, usage). It then builds a directed graph where entities are nodes and relationships are edges. On this graph, it performs various analyses, such as:
- PageRank Analysis: Identifying the most "central" or influential components in the project.
- Community Detection: Grouping related entities into clusters to reveal the natural boundaries of the system.
The results are exported as a JSON data file for further visualization and a Markdown report for human readability.
The project is organized into several modules, each with a specific responsibility:
graphify-core: Contains the core data models (Entity,Relationship,ExtractionResult) used across the entire system.graphify-parser: Uses JavaParser to scan source directories and extract architectural information.graphify-graph: Transforms the raw extracted data into a graph representation using JGraphT.graphify-analysis: Implements analysis algorithms (PageRank, Community Detection) to provide metrics on the code graph.graphify-export: Handles the generation of output files, including JSON graphs and Markdown summary reports.graphify-cli: A command-line interface (powered by picocli) that integrates all modules into a single tool.
- Java 23 or higher.
- Windows environment (for
run-graphify.bat).
The project uses Gradle as its build system. You can build all modules and prepare the distribution by running:
./gradlew buildTo specifically prepare the CLI distribution:
./gradlew :graphify-cli:installDistA convenient batch script run-graphify.bat is provided to automate the build and execution process.
run-graphify.bat <path-to-java-project><path-to-java-project>: (Required) The root directory of the Java project you want to analyze.-o, --output <path>: (Optional) The directory where reports will be saved. Defaults to the current directory.
run-graphify.bat C:\Dev\MyProject -o C:\AnalysisReportsThis will:
- Verify your Java version.
- Build the Graphify project.
- Scan
C:\Dev\MyProject. - Generate
graph_data.jsonand a Markdown report inC:\AnalysisReports.