{"id":19335145,"url":"https://github.com/karami-mehdi/TSP","last_synced_at":"2025-09-12T06:32:28.274Z","repository":{"id":216185959,"uuid":"740678098","full_name":"nsswifter/TSP","owner":"nsswifter","description":"The Traveling Salesman Problem (TSP) aims for the most efficient route across cities. This Python project, employing Tkinter and the Model-View-Controller (MVC) architecture, visualizes TSP solutions. It generates random cities, utilizes the nearest neighbor algorithm, and presents the optimal path with a Tkinter-based GUI.","archived":false,"fork":false,"pushed_at":"2024-07-31T20:27:11.000Z","size":1404,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-10T03:05:01.347Z","etag":null,"topics":["algorithm","mvc","nearest-neighbor-search","nearest-neighbors","python","tkinter","tsp","tsp-problem","tsp-solver"],"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/nsswifter.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":"2024-01-08T20:52:57.000Z","updated_at":"2024-07-31T20:27:15.000Z","dependencies_parsed_at":"2024-01-21T20:00:18.287Z","dependency_job_id":"1e70a06e-14db-49ea-be40-215d75a8e00c","html_url":"https://github.com/nsswifter/TSP","commit_stats":null,"previous_names":["nsswifter/tsp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsswifter%2FTSP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsswifter%2FTSP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsswifter%2FTSP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsswifter%2FTSP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsswifter","download_url":"https://codeload.github.com/nsswifter/TSP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232702305,"owners_count":18563532,"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","mvc","nearest-neighbor-search","nearest-neighbors","python","tkinter","tsp","tsp-problem","tsp-solver"],"created_at":"2024-11-10T03:05:40.636Z","updated_at":"2025-09-12T06:32:22.746Z","avatar_url":"https://github.com/nsswifter.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traveling Salesman Problem (TSP) Visualization\nThis Python project uses Tkinter for creating a GUI to visualize the **Traveling Salesman Problem (TSP)** solution, following the *Model-View-Controller (MVC)* architecture.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"assets/Demo.mov\"/\u003e\u003c/p\u003e\n\n## Table of Contents\n- [Introduction](#introduction)\n- [MVC Architecture](#mvc-architecture)\n- [Dependencies](#dependencies)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction\nThe project aims to visualize the TSP solution (using a Tkinter-based graphical user interface). It generates a specified number of random cities, applies the `nearest neighbor algorithm` to find the optimal path, and visualizes the results.\n\n## MVC Architecture\nThe project's code is organized into three main classes, following the **Model-View-Controller (MVC)** architecture:\n\n- **Model (TSPSolver):** \n   - Implements the nearest neighbor algorithm to solve the TSP.\n   - Represents the model in the MVC architecture, handling data and business logic, such as calculating the TSP solution.\n     \n- **View (TSPView):** \n   - Takes care of drawing cities and the TSP solution on the canvas.\n   - Acts as the view in the MVC architecture, dealing with the user interface and visualization.\n\n- **Controller (TSPController):** \n   - Initializes the Tkinter window.\n   - Manages the GUI components such as the canvas, sliders, and labels.\n   - Handles city initialization, TSP solving, and GUI updates.\n   - Acts as the controller in the MVC architecture, managing user input, updating the model, and triggering visual updates on the view.\n\n\u003cdetails\u003e\n \u003csummary\u003eProject's Source Tree\u003c/summary\u003e\n\n```\n.\n├── LICENSE\n├── README.md\n│\n├── controller\n│   └── tspController.py\n├── main.py\n├── model\n│   ├── city.py\n│   └── tspSolver.py\n└── view\n    ├── tspView.py\n    └── view.py\n```\n\u003c/details\u003e\n\n\u003cp\u003e \u003cimg src=\"assets/tspSolver.png\" width=700\"/\u003e \u003c/p\u003e\n\n## Dependencies\nTo run this project, ensure you have the following dependencies installed:\n\n1. **Python 3.x:** If you don't have Python installed, download and install it from the official [Python website](https://www.python.org/downloads/). Make sure to add Python to your system PATH during installation.\n\n2. **Tkinter:** Tkinter is included with most Python installations. To check if Tkinter is available on your system, open a terminal or command prompt and run the following command:\n   ```bash\n   python -m tkinter\n   ```\n   If Tkinter is installed, a Tkinter window should appear. If not, you may need to install Tkinter separately.\n\n   - On Ubuntu or Debian-based systems, you can install Tkinter using:\n     ```bash\n     sudo apt-get install python3-tk\n     ```\n\n   - On Fedora or Red Hat-based systems, use:\n     ```bash\n     sudo dnf install python3-tkinter\n     ```\n\n   - On macOS, Tkinter is included with the default Python installation.\n\n   - For Windows users, Tkinter is typically included with Python, so no additional steps are needed.\n\n## Usage\n**To use the program:**\n\nExecute the `main.py` script to start the TSP visualization:\n```bash\npython main.py\n```\n\n# Contributing\n\nYour contributions are greatly valued! Feel free to contribute to the project.\n\n# License\nThis project is licensed under the **MIT** - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarami-mehdi%2FTSP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarami-mehdi%2FTSP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarami-mehdi%2FTSP/lists"}