A protocol for calculating the best paths for networks