private Map < String , EdgeIteratorState > createVirtualEdgesMap ( List < Collection < QueryResult > > queriesPerEntry , EdgeExplorer explorer ) { // TODO For map key, use the traversal key instead of string! Map < String , EdgeIteratorState > virtualEdgesMap = new HashMap <> ( ) ; for ( Collection < QueryResult > queryResults : queriesPerEntry ) { for ( QueryResult qr : queryResults ) { if ( isVirtualNode ( qr . getClosestNode ( ) ) ) { EdgeIterator iter = explorer . setBaseNode ( qr . getClosestNode ( ) ) ; while ( iter . next ( ) ) { int node = traverseToClosestRealAdj ( explorer , iter ) ; if ( node == qr . getClosestEdge ( ) . getAdjNode ( ) ) { virtualEdgesMap . put ( virtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( false ) ) ; virtualEdgesMap . put ( reverseVirtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( true ) ) ; } else if ( node == qr . getClosestEdge ( ) . getBaseNode ( ) ) { virtualEdgesMap . put ( virtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( true ) ) ; virtualEdgesMap . put ( reverseVirtualEdgesMapKey ( iter ) , qr . getClosestEdge ( ) . detach ( false ) ) ; } else { throw new RuntimeException ( ) ; } } } } } return virtualEdgesMap ; }
Returns a map where every virtual edge maps to its real edge with correct orientation .