Modern software systems increasingly blend monolithic and microservice paradigms. While monoliths offer simplicity and maintainability, microservices bring scalability and independence. The challenge lies in how to split a system — poor decomposition creates tight inter-module coupling and weak intra-module cohesion, making systems brittle and hard to evolve.
This project builds a mathematically grounded decision-support tool that recommends optimal hybrid architectures. We model a software system as a weighted dependency graph and use combinatorial optimization to find component groupings that maximize cohesion within clusters and minimize coupling across them.
🏆 Results Summary
All three methods successfully recover the ground-truth decomposition:
Metric
Spectral
Genetic Algorithm
Louvain
Ground Truth
Modularity Q
0.7571
0.7571
0.7571
0.7571
Avg. Cohesion
0.5036
0.5036
0.5036
0.5036
Avg. Coupling
0.0114
0.0114
0.0114
0.0114
NMI
1.0000
1.0000
1.0000
1.0000
ARI
1.0000
1.0000
1.0000
1.0000
Runtime (s)
0.078
2.847
0.004
—
Visual Comparison
Final Comparison
🎯 Objectives
#
Objective
Status
1
Formalize software systems as weighted graphs
✅
2
Define quantitative metrics for cohesion & coupling
✅
3
Formulate decomposition as multi-objective optimization
Covers: software architecture basics, Kubernetes & containers, coupling/cohesion problem, existing approaches, and why we need math.
Step 1 — Understand the Dataset
File:data/synthetic_dependency_graph.csv
Column
Description
source
Source component (e.g., auth_00, billing_03)
target
Target component
weight
Dependency strength (0.0–1.0)
true_cluster
Ground-truth cluster label (0–4) or "cross" for inter-cluster edges
The graph has 60 nodes across 5 services (auth, billing, catalog, orders, notify) with 320 edges.
Step 2 — Run the Three Notebooks
📓 Notebook 1 — Spectral Graph Partitioning
Uses the graph Laplacian $L = D − A$ and its eigenvectors. The eigengap heuristic correctly identifies K=5 clusters.
Eigenvalue Spectrum
Spectral Results
📓 Notebook 2 — Genetic Algorithm
Evolutionary optimization with tournament selection, uniform crossover, and random mutation. Includes sensitivity analysis and fitness landscape visualization.
GA Convergence
GA Sensitivity
📓 Notebook 3 — Louvain Community Detection
Greedy modularity maximization with resolution parameter analysis. Includes the final three-method comparison.