question: private static void findBidirectionalEdges ( List < Tuple < Integer , Integer > > edgeList , String path , String fileName ) { log . info ( "Looking for bidirectional edges." ) ; List < Tuple < Integer , Integer > > bidirectionalList = new ArrayList < Tuple < Integer , Integer > > ( ) ; List < Tuple < Integer , Integer > > toRemoveList = new ArrayList < Tuple < Integer , Integer > > ( ) ; for ( int i = 0 ; i < edgeList . size ( ) ; i ++ ) { Tuple < Integer , Integer > thisEdge = edgeList . get ( i ) ; int source = thisEdge . getFirst ( ) ; int destination = thisEdge . getSecond ( ) ; Tuple < Integer , Integer > reverseEdge = new Tuple < Integer , Integer > ( destination , source ) ; int reverseSource = reverseEdge . getFirst ( ) ; int reverseDestination = reverseEdge . getSecond ( ) ; if ( toRemoveList . contains ( reverseEdge ) ) { } else { for ( int j = 0 ; j < edgeList . size ( ) ; j ++ ) { Tuple < Integer , Integer > nextEdge = edgeList . get ( j ) ; int nextSource = nextEdge . getFirst ( ) ; int nextDestination = nextEdge . getSecond ( ) ; if ( ( reverseSource == nextSource ) && ( reverseDestination == nextDestination ) ) { bidirectionalList . add ( thisEdge ) ; toRemoveList . add ( thisEdge ) ; toRemoveList . add ( nextEdge ) ; } } } } edgeList . removeAll ( toRemoveList ) ; String bidirectionalFileName = fileName + "_bidirectional.txt" ; String onedirectionalFileName = fileName + "_onedirectional.txt" ; writeOutput ( bidirectionalList , path , fileName , bidirectionalFileName ) ; writeOutput ( edgeList , path , fileName , onedirectionalFileName ) ; }
target:  This method iterates through the edge list looking for bidirectional edges. For each edge, it determines its reverse edge (swaps source and destination nodes). It then iterates through the rest of the edge list to see if any of the edges matches the reverse edge. If it does, it means that this edge is bidirectional. It removes both the current edge and the identified reverse edge and places the edge (only one copy) in a separate list, the  bidirectional edge list. 