time complexity - A Class-Based Shortest Path Algorithm -


given n classes of locations may each contain minimum of 1 location of form (x,y) in each class, how can find path contains 1 such (x,y) every class such path 1 shortest possible distance among choices.

for example:
class a: [(1,1), (10,1)]
class b: [(20,1), (2,2), (1,15)]
class c: [(4,4)]
class d: [(8,8), (5,5), (3,3)]

solution (1,1) -> (2,2) -> (3,3) -> (4,4).

understand possible appliying shortest path algorithm , computing cost every combination, not computationally feasible number of possible solutions multiplicatively increases number of classes , locations in each class (in above example, 2 * 3 * 1 * 3 possible paths).

you can reduce hamiltonian path in euclidean space problem. have make each class hold single point.

using this, can prove problem in np-hard, i.e., no solution better backtracking.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -