Bellman Ford algorithm chech it out...