Amazon interview question

Graphs - finding segment between two child nodes