List < IntArrayList > findSubnetworks ( PrepEdgeFilter filter ) { final BooleanEncodedValue accessEnc = filter . getAccessEnc ( ) ; final EdgeExplorer explorer = ghStorage . createEdgeExplorer ( filter ) ; int locs = ghStorage . getNodes ( ) ; List < IntArrayList > list = new ArrayList <> ( 100 ) ; final GHBitSet bs = new GHBitSetImpl ( locs ) ; for ( int start = 0 ; start < locs ; start ++ ) { if ( bs . contains ( start ) ) continue ; final IntArrayList intList = new IntArrayList ( 20 ) ; list . add ( intList ) ; new BreadthFirstSearch ( ) { int tmpCounter = 0 ; @ Override protected GHBitSet createBitSet ( ) { return bs ; } @ Override protected final boolean goFurther ( int nodeId ) { if ( tmpCounter > maxEdgesPerNode . get ( ) ) maxEdgesPerNode . set ( tmpCounter ) ; tmpCounter = 0 ; intList . add ( nodeId ) ; return true ; } @ Override protected final boolean checkAdjacent ( EdgeIteratorState edge ) { if ( edge . get ( accessEnc ) || edge . getReverse ( accessEnc ) ) { tmpCounter ++ ; return true ; } return false ; } } . start ( explorer , start ) ; intList . trimToSize ( ) ; } return list ; }
This method finds the double linked components according to the specified filter .