Welcome to TSP spanning tree’s documentation!¶
Functions¶
This is tsp_spanning module. Currently its contains tsp()
function
and wrappers which simplify usage on list of points
-
tsp_spanning.
tsp
(np.ndarray[np.float64_t, ndim=2] distances, int end=-1)¶ Function to calculate tsp path with spanning tree. Returned path always start with point with index 0.
Parameters: - distances (np.ndarray[np.float64_t, ndim=2]) – distances matrix
- end – point in which tsp path should end. -1 means not use
Returns: list of point in order
Return type: np.ndarray
-
tsp_spanning.
point_tsp
(points)¶ this function calculate distance matrix for given list of points then calculate tsp solution and return points in new order
Parameters: points – points to be visited Returns: points in new order Return type: np.ndarray
-
tsp_spanning.
points_to_distance_matrix
(points)¶ This function is replacement of scipy.spatial.distance.cdist if one do not need whole scipy module only for one function.
Parameters: points (np.ndarray) – points to calculate distance matrix. Returns: distance matrix Return type: np.ndarray