{"id":27981939,"url":"https://github.com/msadeqsirjani/mstree-bench","last_synced_at":"2025-07-14T12:37:00.848Z","repository":{"id":285791465,"uuid":"959359428","full_name":"msadeqsirjani/MSTree-Bench","owner":"msadeqsirjani","description":"A benchmarking toolkit for comparing Kruskal's and Prim's minimum spanning tree algorithms across various graph configurations, with visualization tools and performance analysis reports.","archived":false,"fork":false,"pushed_at":"2025-04-02T17:08:21.000Z","size":5950,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T18:23:39.054Z","etag":null,"topics":["algorithm-comparison","algorithm-visualization","benchmarking","data-structures","graph-algorithms","kruskal-algorithm","minimum-spanning-tree","performance-analysis","prim-algorithm","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msadeqsirjani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-02T17:01:00.000Z","updated_at":"2025-04-02T17:08:32.000Z","dependencies_parsed_at":"2025-04-02T18:23:47.447Z","dependency_job_id":"2bcc0139-42e1-40a0-baae-4633ce8a46f1","html_url":"https://github.com/msadeqsirjani/MSTree-Bench","commit_stats":null,"previous_names":["msadeqsirjani/mstree-bench"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msadeqsirjani%2FMSTree-Bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msadeqsirjani%2FMSTree-Bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msadeqsirjani%2FMSTree-Bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msadeqsirjani%2FMSTree-Bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msadeqsirjani","download_url":"https://codeload.github.com/msadeqsirjani/MSTree-Bench/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252994240,"owners_count":21837390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm-comparison","algorithm-visualization","benchmarking","data-structures","graph-algorithms","kruskal-algorithm","minimum-spanning-tree","performance-analysis","prim-algorithm","python"],"created_at":"2025-05-08T03:32:30.531Z","updated_at":"2025-05-08T03:34:02.173Z","avatar_url":"https://github.com/msadeqsirjani.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MSTree-Bench\n\n\u003cdiv align=\"center\"\u003e\n\u003cpre\u003e\n    ███╗   ███╗███████╗████████╗\n    ████╗ ████║██╔════╝╚══██╔══╝\n    ██╔████╔██║███████╗   ██║   \n    ██║╚██╔╝██║╚════██║   ██║   \n    ██║ ╚═╝ ██║███████║   ██║   \n    ╚═╝     ╚═╝╚══════╝   ╚═╝   \n                              \n ALGORITHMS EXPERIMENTAL ANALYSIS\n\u003c/pre\u003e\n  \u003cbr\u003e\n  \u003cem\u003eComparing Kruskal's and Prim's algorithms through experimental analysis\u003c/em\u003e\n  \u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://github.com/msadeqsirjani/MSTree-Bench\"\u003e\u003cstrong\u003ehttps://github.com/msadeqsirjani/MSTree-Bench\u003c/strong\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\nA benchmarking toolkit for comparing Kruskal's and Prim's minimum spanning tree algorithms across various graph configurations, with visualization tools and performance analysis reports.\n\n## Project Structure\n\n```\n.\n├── docs/                          # Documentation\n│   └── HW 4 - Experiments with MST Algorithms-1.pdf  # Assignment specs\n│\n├── logs/                          # Log files (created when running)\n│\n├── reports/                       # Generated reports and visualizations\n│   ├── mst_analysis_report.html   # HTML report with analysis\n│   ├── mst_analysis_report.md     # Markdown version of the report\n│   ├── comparison_plot.png        # Performance comparison chart\n│   ├── size_comparison.png        # Graph size impact visualization\n│   ├── density_comparison.png     # Density impact visualization\n│   └── ...                        # Other generated files\n│\n├── src/                           # Source code\n│   ├── main.py                    # Main entry point\n│   ├── mst.py                     # MST algorithm implementations\n│   ├── experiment.py              # Experimental procedures\n│   ├── report_generator.py        # Report generation logic\n│   └── logger.py                  # Logging utilities\n│\n├── venv/                          # Virtual environment (created when running)\n│\n├── README.md                      # Project documentation\n├── requirements.txt               # Project dependencies\n└── run.sh                         # Execution script\n```\n\n## Requirements\n\nThis project requires Python 3.6+ with the following packages:\n- matplotlib\n- numpy\n\n## How to Run\n\n### Using the Run Script (Recommended)\n\nThe easiest way to run the project is by using the included run script:\n\n```bash\n./run.sh\n```\n\nThis script will:\n1. Create a virtual environment if it doesn't exist\n2. Install required dependencies\n3. Create necessary directories\n4. Run the main program\n5. Deactivate the virtual environment when finished\n\n### Manual Execution\n\nAlternatively, you can run the project manually:\n\n1. Create and activate a virtual environment (optional but recommended):\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n2. Install the required packages:\n```bash\npip install matplotlib numpy\n```\n\n3. Run the main script:\n```bash\npython src/main.py\n```\n\n## Experiment Details\n\nThe project runs several experiments:\n\n1. **Effect of Graph Size**: Comparing algorithm performance as the number of vertices increases from 10 to 1000\n2. **Effect of Graph Density**: Comparing algorithm performance as the graph density changes from very sparse (0.01) to dense (0.9)\n3. **Edge Count Comparison**: Performance across different edge-to-vertex ratios for various graph sizes\n4. **Crossover Point Analysis**: Finding where Prim's algorithm becomes more efficient than Kruskal's\n5. **Theoretical Analysis**: Comparing experimental results with theoretical time complexities\n\n## Viewing Results\n\nAfter running the program, you can view the results in two formats:\n\n### HTML Report\nA comprehensive HTML report is generated at:\n```\nreports/mst_analysis_report.html\n```\n\n### Markdown Report\nA markdown version of the report is available at:\n```\nreports/mst_analysis_report.md\n```\n\nThe reports include:\n- Detailed descriptions of the algorithms\n- Performance data tables\n- Visualizations of the results\n- Analysis of the findings\n\n## Implementation Details\n\n### Data Structures\n- **MinHeap**: Custom implementation for priority queue operations needed by Prim's algorithm\n- **DisjointSet**: Implementation with path compression and union by rank for Kruskal's algorithm\n\n### Kruskal's Algorithm\nKruskal's algorithm uses a disjoint-set data structure with path compression and union by rank for efficiency. The implementation sorts all edges and adds them to the MST in order of increasing weight if they don't create a cycle.\n\nTime complexity: O(E log E), where E is the number of edges.\n\n### Prim's Algorithm\nPrim's algorithm uses a binary heap (priority queue) to efficiently select the next minimum-weight edge to add to the MST. It starts from a single vertex and grows the MST by adding one vertex at a time.\n\nTime complexity: O(E log V), where V is the number of vertices.\n\n### Random Graph Generation\nThe graph generation function creates random connected graphs with:\n- Specified number of vertices (n)\n- Specified number of edges (m)\n- Random edge weights\n- Guaranteed connectivity\n\nSpecial handling is implemented for:\n- Complete graphs\n- Dense graphs (using deletion approach)\n- Sparse graphs (using addition approach)\n\n## Logging\n\nDetailed logging is implemented throughout the project, capturing:\n- Experiment progress\n- Graph generation details\n- Algorithm execution\n- Performance measurements\n\nLogs are stored in the `logs/` directory for debugging and analysis. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsadeqsirjani%2Fmstree-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsadeqsirjani%2Fmstree-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsadeqsirjani%2Fmstree-bench/lists"}