sdboyer / gliph

A graph library for PHP.
MIT License
170 stars 7 forks source link

Implement Dijkstra's shortest path algo #6

Open sdboyer opened 10 years ago

sdboyer commented 10 years ago

Any graph library is incomplete without doing SOME implementation of Dijkstra's algorithm.

wimleers commented 10 years ago

I wonder how Dijkstra in PHP/gliph will compare with Python and C++ (see http://wimleers.com/work/project/squirreltracker-3000) — we found a C++ implementation using a binary heap significantly faster than any optimized implementation in Python and "naive" implementations in C++.

sdboyer commented 10 years ago

yeah, we'll see how we can do. it certainly won't touch C++, and i doubt it'll really touch optimized python, either. too much iteration is done in userspace. there are some facilities provided by SPL - primarily, a minheap - that might allow it to be reasonably fast, but so much of how gliph works now is based on hashtable lookups, and those are (relatively) slow.

still, it will be fun to do some comparisons. i would hope that my go implementation could eventually rival something in C++ :)