Given edges
List < List < int > > edges = new List < List < int > > ( ) ; edges . Add ( new List < int > { 1 , 0 } ) ; edges . Add ( new List < int > { 0 , 2 } ) ; edges . Add ( new List < int > { 5 , 3 } ) ; edges . Add ( new List < int > { 3 , 4 } ) ; edges . Add ( new List < int > { 6 , 7 } ) ;