### Question:
PrepareRoutingSubnetworks { List<TIntArrayList> findSubnetworks( PrepEdgeFilter filter ) { final FlagEncoder encoder = filter.getEncoder(); final EdgeExplorer explorer = ghStorage.createEdgeExplorer(filter); int locs = ghStorage.getNodes(); List<TIntArrayList> list = new ArrayList<TIntArrayList>(100); final GHBitSet bs = new GHBitSetImpl(locs); for (int start = 0; start < locs; start++) { if (bs.contains(start)) continue; final TIntArrayList intList = new TIntArrayList(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 (encoder.isForward(edge.getFlags()) || encoder.isBackward(edge.getFlags())) { tmpCounter++; return true; } return false; } }.start(explorer, start); intList.trimToSize(); } return list; } PrepareRoutingSubnetworks( GraphHopperStorage ghStorage, Collection<FlagEncoder> encoders ); PrepareRoutingSubnetworks setMinNetworkSize( int minNetworkSize ); PrepareRoutingSubnetworks setMinOneWayNetworkSize( int minOnewayNetworkSize ); void doWork(); int getMaxSubnetworks();  }### Answer:
@Test public void testFindSubnetworks() { GraphHopperStorage g = createSubnetworkTestStorage(); PrepEdgeFilter filter = new PrepEdgeFilter(carFlagEncoder); PrepareRoutingSubnetworks instance = new PrepareRoutingSubnetworks(g, Collections.singleton(carFlagEncoder)); List<TIntArrayList> components = instance.findSubnetworks(filter); assertEquals(3, components.size()); assertEquals(Helper.createTList(0, 7, 3, 13, 5), components.get(0)); assertEquals(Helper.createTList(1, 8, 4, 2, 11, 12, 9, 15), components.get(1)); assertEquals(Helper.createTList(6, 14, 10), components.get(2)); }