algorithm - Shortest path to connect n points -
algorithm - Shortest path to connect n points -
i have n points , need connect of them minimizing final distance. image above represents algorithm in each node connects nearest 1 final output might of.
i've been searching lot, know pathfinding algos unaware of 1 solves case. found question on math stackexchange reply not providing algorithm - http://math.stackexchange.com/a/581844/156584.
is there algorithm solves problem? otherwise can bruteforce it.
edit: clarification regarding result i'm expecting: each node can connected 2 other nodes, creating continuous path (like taking pen , without ever lifting it, connect nodes minimizing final distance). don't want create cycle (that beingness travelling salesman problem).
ps: question can translated "complete graph n vertices, , wanting take set of edges such graph connected, sum of border weights minimized"
this problem known shortest hamiltonian path problem , np-hard. if number of points small, can utilize backtracking or dynamic programming find optimal solution. if number of points large, can utilize heuristics and/or approximations obtain relatively answer(it not possible find best 1 in case, though).
algorithm graph shortest-path
Comments
Post a Comment