Hi-
This is my thoughts. Take this example. I am travelling from Indiana to Lasvegas (roundtrip)
The flight details are
IND->ATLANTA-LASVEGAS (TO)
LASVEGAS->ATLANTA->IND(BACK)
For this roundtrip there is 2 segments , and each segment has multilple "legs" or layover. If you think in this way the solution can be find.
What say?
Ranjeeth