• Title/Summary/Keyword: Manhatton distance

Search Result 1, Processing Time 0.015 seconds

Algorithm for Cross-avoidance Bypass Routing in Numberlink Puzzle (숫자 연결 퍼즐에 관한 교차 회피 우회 경로 알고리즘)

  • Sang-Un Lee
    • The Journal of the Institute of Internet, Broadcasting and Communication
    • /
    • v.24 no.3
    • /
    • pp.95-101
    • /
    • 2024
  • The numberlink puzzle(NLP), which non-crossings with other numbers of connection in connecting lines through empty cells between a given pair of numbers, is an NP-complete problem with no known way to solve the puzzle in polynomial time. Until now, arbitrary numbers have been selected and puzzles have been solved using trial-and-error methods. This paper converts empty cells into vertices in lattice graphs connected by edge between adjacent cells for a given problem. Next, a straight line was drawn between the pairs of numbers and divided into groups of numbers where crossing occurred. A bypass route was established to avoid intersection in the cross-number group. Applying the proposed algorithm to 18 benchmarking data showed that the puzzle could be solved with a linear time complexity of O(n) for all data.