Add traveling salesman visualizer at /tsp#168
Merged
Conversation
Two-stage solve as a single generator pipeline: nearest-neighbor construction yields the tour one city at a time, then 2-opt repeatedly reverses segments whose endpoints would reconnect shorter, yielding after each improving swap until a full pass finds none (a 2-opt local optimum). Header tracks live tour length and, once done, the percent saved over the greedy tour. The route closes visually when improvement begins; crossings visibly untangle. Click adds cities between runs; city presets 20/40/80; speed slider controls events per tick. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
✅ Deploy Preview for ianalloway ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ianalloway
marked this pull request as ready for review
July 19, 2026 04:56
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
# Conflicts: # src/App.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/tsp— watch a TSP tour get built greedily, then untangled by 2-opt in real timesrc/features/tsp/tour.ts: nearest-neighbor construction and 2-opt segment-reversal improvement, both as generators yielding per-step events; tour length; random city scatteringsrc/pages/Tsp.tsx: canvas with cyan cities (yellow ring on start), animated tour, phase status, live tour length, %-saved readout, city presets (20/40/80), speed slider, click-to-add citiessrc/App.tsx: lazy-loaded/tsproute with SEO metadataHow it works
Test plan
/tsp— 40 cities scattered; solve builds the greedy path city by cityGenerated by Claude Code