A fixed matrix method for all shortest distances in a directed graph and for the inverse problem