I have received the task to make a social graph, where, with one user in the center, it shows the connections he has. But before we can reach that, our focus is how we can determine the shortest path between 2 users. I found some algorithm to do it, but it seems that it takes a lot of time, and because it's about social links, we are looking for one that is the fastest because we will need to run it on a regular basis to keep up with the updates in friends.
So, do you know which would be the fastest way to determine the shortest path between two users?
PS: If you know an example in PHP & MySQL, I will give you a virtual beer (or coke). :D