Text this: Optimal algorithm based on weight balancing for designing the logical topology of the optical network