Comparing a naive "nearest neighbor" #TravellingSalesmanProblem solver with a #2optSwap one, adding a #DelaunayTriangulation mesh, it shows how often the better solution falls into the triangulation!
The #py5 sketch is interactive, you can generate other random nodes and move them around dragging with the mouse.
Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_02_15
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724
#scipy #Processing #Python #TSP #CreativeCoding