Floyd-wharshall algoritm for the shortest path problem. I wrote this in C. It s easy to compile and work in all *nix like systems.