Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    \$\begingroup\$ Welcome to Programming Puzzles & Code Golf! Amazing first answer! \$\endgroup\$ Commented Mar 14, 2016 at 21:00
  • \$\begingroup\$ This fails to find the longest path even on the smallest 3×3 example case: it finds a path through 6 nodes instead of 7. I don’t particularly blame you for that, because even the question author doesn’t seem to realize that this problem is NP-complete, but you could have at least mentioned it. There is no way A-star can produce optimal solutions, no matter what heuristic you give it, because it will never revisit a vertex that it previously found on a different path. \$\endgroup\$ Commented Jul 23, 2018 at 2:35