Deflection routing algorithms dont explain how to choose packets to be misdirected, nor even how many packets. There are efficient graph algorithms, which provide optimal solutions in term of number of deflections at each time slot. However to implement them is quite complex. Although their complexity is polynomial, they dont fulfill the time requirements of the optical switches. We have created some algorithms to choose, at every step, the optimal path that packets must follow, from origin to destination. These methods have the property of reducing the number of deflections that the packets undergo. We have proved a distributed algorithm which deflects the smallest number of customers in every node of the net. We have called it Minimal Deflection Algorithm and we have evaluated its performance in an all-optical network. Every node sends the packets to their optimal routes, the shortest path to their destination, the path with the minimum number of deflections. We have also developped the Scale Routing algorithm, which minimize the number of deflections on the total trajectory to find the optimal route, even if packets were deflected.