Skip to content

Instantly share code, notes, and snippets.

View peter-dye's full-sized avatar

Peter Dye peter-dye

View GitHub Profile
@payoung
payoung / tsp_plot.py
Created July 26, 2013 07:51
Python function that plots the data from a traveling salesman problem that I am working on for a discrete optimization class on Coursera. It can take multiple iterations of the path between nodes and plot out the current path as well as the old paths. Helps with troubleshooting and improving the algorithms that I am working on.
import matplotlib.pyplot as plt
def plotTSP(path, points, num_iters=1):
"""
path: List of lists with the different orders in which the nodes are visited
points: coordinates for the different nodes
num_iters: number of paths that are in the path list
"""