Skip to content

feat: Add Traveling Salesperson (TSP) Visualizer#1329

Merged
steam-bell-92 merged 4 commits into
steam-bell-92:mainfrom
KunwarSidhu47:main
Jun 22, 2026
Merged

feat: Add Traveling Salesperson (TSP) Visualizer#1329
steam-bell-92 merged 4 commits into
steam-bell-92:mainfrom
KunwarSidhu47:main

Conversation

@KunwarSidhu47

@KunwarSidhu47 KunwarSidhu47 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR introduces the Traveling Salesperson Problem (TSP) Visualizer under the Utilities section. It provides an interactive environment to visualize and understand different algorithmic approaches to solving the TSP on a 2D coordinate plane.

Key Features & Changes

  • Python Implementation (TSP-Visualizer.py): Added an interactive Pygame-based window that allows users to place nodes with their mouse and visualize shortest paths.
  • Web App Canvas Integration: Added tsp-visualizer.js to mirror the Python experience natively in the browser via HTML5 Canvas.
  • Algorithms Supported:
    • Nearest Neighbor (Greedy): A fast, greedy approach that picks the closest unvisited node.
    • Brute Force: Computes all permutations to guarantee the absolute shortest path (safeguarded against crashing the browser for large node counts).
  • Banner Asset Generation: Updated generate_banners.py to automatically procedurally generate a vector banner (tsp-visualizer.webp) tailored for the TSP project.
  • App Registry Updates: Integrated the visualizer into projects_registry.json, index.html, and projects.js so it flawlessly renders in the grid and is searchable.

Testing Instructions

  1. Navigate to the web app locally and search for "TSP".
  2. Open the project modal, click to add points to the canvas (or use the Random Nodes button).
  3. Select an algorithm from the dropdown and click Visualize.
  4. To test the Pygame desktop application, run python3 utilities/TSP-Visualizer/TSP-Visualizer.py.

Live Demo Video and Screenshots

TSP.VIsualizer.mov
Screenshot 2026-06-22 at 8 13 16 PM Screenshot 2026-06-22 at 8 13 26 PM

Closes #1310

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@KunwarSidhu47

Copy link
Copy Markdown
Contributor Author

Hi @steam-bell-92 ,

The Traveling Salesperson Problem (TSP) Visualizer has been implemented and live demo video, screenshots have been attached.

Kindly review the PR and tell if any changes are to be made. Thanks !

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
python-mini-project Ready Ready Preview, Comment Jun 22, 2026 3:52pm

@steam-bell-92 steam-bell-92 merged commit 317ab4d into steam-bell-92:main Jun 22, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.
Thanks again for your support! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🎮 [Proposal]: Add interactive Traveling Salesperson (TSP) Visualizer to utilities lab

2 participants