first version of Johnson algorithm
working on Johnson and Tarjan