A comprehensive implementation and analysis of various maximum clique algorithms.
MaximumClique/
├── algorithms/ # Core algorithm implementations
│ ├── bron_kerbosch.py
│ ├── greedy.py
│ ├── local_random.py
│ ├── local_search.py
│ ├── randomized.py
│ └── simulated_annealing.py
├── bonus/ # Additional features and analysis
│ ├── bk_runtime_analysis.png
│ ├── desc_ree.py
│ ├── estimate_bk.py
│ ├── my_logic_tree.png
│ └── recommend.py
├── data/ # Graph datasets
│ ├── download_graphs.py
│ ├── small_graphs/ # < 100 nodes
│ ├── medium_graphs/ # 100-400 nodes
│ └── large_graphs/ # > 400 nodes
├── experiments/ # Jupyter notebooks for testing
│ ├── small_graphs.ipynb
│ ├── medium_graphs.ipynb
│ ├── large_graphs.ipynb
│ └── random.ipynb
├── results/ # Generated outputs and visualizations
│ ├── experiment_log.csv
│ ├── graphs/ # Graph visualizations by size
│ ├── plots/ # Analysis charts
│ ├── scripts/ # Plot generation scripts
│ └── std_analysis/ # Statistical analysis
├── README.md
└── requirements.txt
Before running any code, install the required dependencies:
pip install -r requirements.txtNavigate to the algorithms directory and run any algorithm:
cd MaximumClique/algorithms
python3 bron_kerbosch.py
python3 greedy.py
python3 local_random.py
python3 local_search.py
python3 randomized.py
python3 simulated_annealing.pyEach file contains example graphs in its main() function.
Get intelligent algorithm recommendations based on graph properties:
cd MaximumClique/bonus
python3 recommend.pyWarning: This analysis takes days to complete!
cd MaximumClique/bonus
python3 estimate_bk.pyView results:
bk_runtime_analysis.png- Runtime analysis visualizationmy_logic_tree.png- Decision tree logic
- Add a
(name, link)tuple to thedatasetslist indownload_graphs.py - Ensure compatibility with current loading and conversion formats
- Run:
cd MaximumClique/data
python3 download_graphs.py-
Small Graphs (
data/small_graphs/)- Karate club, Dolphins, Florentine families, Les Miserables, etc.
-
Medium Graphs (
data/medium_graphs/)- Brock200 series, C125.9, C250.9, MANN_a27, Johnson16-2-4, etc.
-
Large Graphs (
data/large_graphs/)- Brock400/800 series, C500.9, C1000.9, Facebook combined, DSJC series, etc.
Run experiments using Jupyter notebooks:
cd MaximumClique/experiments
# Open and run:
# - small_graphs.ipynb
# - medium_graphs.ipynb
# - large_graphs.ipynb
# - random.ipynbBrowse graph visualizations organized by size:
cd MaximumClique/results/graphs/
# View subdirectories:
# - small_graphs/
# - medium_graphs/
# - large_graphs/Each graph includes:
{graph_name}.png- Visual representation{graph_name}_stats.png- Statistical analysis
View comparative analysis charts:
cd MaximumClique/results/plots/Available plots:
algorithm_comparison_bars.pngaccuracy_comparison_chart.pngruntime_comparison_chart.pngmemory_comparison_chart.pngruntime_vs_quality_scatter.pngaccuracy_sparse_vs_dense.pngruntime_sparse_vs_dense.png
View stability and variance analysis:
cd MaximumClique/results/std_analysis/Includes:
coefficient_of_variation.pngvariability_heatmap.pngaccuracy_stability_by_size.pngruntime_stability_by_size.pngclique_size_std_by_algorithm.pngcomprehensive_comparison.csvsummary_report.txt
Generate plots and perform analysis:
cd MaximumClique/results/scripts/
# Individual scripts:
python3 accuracy_chart.py # Generate accuracy comparisons
python3 runtime_chart.py # Generate runtime comparisons
python3 density_accuracy.py # Analyze density vs accuracy
python3 plot_density_runtime.py # Plot density vs runtime
python3 runtime_vs_quality.py # Quality-runtime tradeoff analysis
python3 std_deviation_analysis.py # Statistical variance analysis
python3 generate_bar_graphs.py # Generate bar chart comparisons
python3 plot_from_logs.py # Generate plots from experiment logs
python3 save_graphs.py # Save graph visualizations
python3 debug_algorithms.py # Debug and test algorithmsAll experiment results are logged to:
MaximumClique/results/experiment_log.csv
Install required dependencies:
pip install -r requirements.txt| Algorithm | Type | Best For |
|---|---|---|
| Bron-Kerbosch | Exact | Small to medium graphs, finding all cliques |
| Greedy | Heuristic | Fast approximations, large graphs |
| Local Search | Optimization | Medium graphs, quality solutions |
| Local Random | Randomized | Diverse solution space exploration |
| Randomized | Probabilistic | Large graphs with time constraints |
| Simulated Annealing | Metaheuristic | Complex graphs, avoiding local optima |
- Results are automatically saved with timestamps
- All visualizations are PNG format
- CSV files contain raw data for further analysis
- Use the algorithm recommender for optimal algorithm selection based on your graph properties