"""Master orchestration script: run all methods, compute accuracy and stats, generate plots.""" import sys import os import time sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from config import NETWORKS, METHODS def main(): start = time.time() print("=" * 60) print("EC-SBM Community Detection Analysis Pipeline") print("=" * 60) # Step 1: Run community detection methods for net_name in NETWORKS: for method in METHODS: m_name = method["name"] m_type = method["type"] print(f"\n{'='*60}") print(f"Running {m_name} on {net_name}") print(f"{'='*60}") if m_type == "leiden": from run_leiden import run_leiden run_leiden(net_name, m_name, method["quality"], method.get("resolution")) elif m_type == "infomap": from run_infomap import run_infomap run_infomap(net_name) elif m_type == "graphtool_sbm": from run_graphtool_sbm import run_graphtool_sbm run_graphtool_sbm(net_name) # Step 2: Compute accuracy print(f"\n{'='*60}") print("Computing accuracy metrics") print(f"{'='*60}") from compute_accuracy import compute_all_accuracy compute_all_accuracy() # Step 3: Compute cluster stats print(f"\n{'='*60}") print("Computing cluster statistics") print(f"{'='*60}") from compute_stats import compute_all_stats compute_all_stats() # Step 4: Generate plots and tables print(f"\n{'='*60}") print("Generating plots and LaTeX tables") print(f"{'='*60}") from generate_plots import generate_all generate_all() elapsed = time.time() - start print(f"\n{'='*60}") print(f"Pipeline complete in {elapsed:.1f}s") print(f"{'='*60}") if __name__ == "__main__": main()