5

Does anyone have an implementation of the A* algorithm in PHP? I know that wikipedia has a pseudocode and a link to a C++ one, but I can't seem to find one already written in PHP.

I am also looking for an efficient written A* algorithm

aherlambang
  • 14,290
  • 50
  • 150
  • 253
  • 1
    I bet linking to the algorithm in your question would help anyone that feels ambitious to make a port. -- EDIT: `http://en.wikipedia.org/wiki/A*_search_algorithm` – Brad Christie Feb 25 '11 at 00:06
  • there's nothing there, it's a wiki page... – aherlambang Feb 25 '11 at 00:09
  • @Equinox: It drops the * in the URL. Add it back after the A, it should work. – Brad Christie Feb 25 '11 at 00:10
  • I know, but that's not a PHP implementation... saw that link already – aherlambang Feb 25 '11 at 00:11
  • 2
    Sounds kind of easy enough to write, once you understand it. (http://www.youtube.com/watch?v=Kw8AMmyc6vg) – Brad Christie Feb 25 '11 at 00:34
  • The speed of A* depends a lot on your datastructure. Your question is impossible to answer if you don't explain what your datastructure looks like. once you've cleared that out and have your heuristic function ready it's really as simple as porting the pseudo-code from the wikipedia page mentioned by Brad. – kritzikratzi Feb 25 '11 at 19:22
  • what do you mean by data structure here? the set of nodes - edge? If that's the case then I have that already in the database as nodes - edge – aherlambang Feb 26 '11 at 05:26
  • github repo with a sample a-star class https://github.com/jmgq/php-a-star – tristanbailey Dec 30 '19 at 23:54

0 Answers0