### Question:
PrepareRoutingSubnetworks { int removeDeadEndUnvisitedNetworks(final DefaultEdgeFilter bothFilter) { StopWatch sw = new StopWatch(bothFilter.getAccessEnc() + " findComponents").start(); final EdgeFilter outFilter = DefaultEdgeFilter.outEdges(bothFilter.getAccessEnc()); TarjansSCCAlgorithm tarjan = new TarjansSCCAlgorithm(ghStorage, outFilter, true); List<IntArrayList> components = tarjan.findComponents(); logger.info(sw.stop() + ", size:" + components.size()); return removeEdges(bothFilter, components, minOneWayNetworkSize); } PrepareRoutingSubnetworks(GraphHopperStorage ghStorage, List<FlagEncoder> encoders); PrepareRoutingSubnetworks setMinNetworkSize(int minNetworkSize); PrepareRoutingSubnetworks setMinOneWayNetworkSize(int minOnewayNetworkSize); void doWork(); int getMaxSubnetworks();  }### Answer:
@Test public void testRemoveDeadEndUnvisitedNetworks() { GraphHopperStorage g = createDeadEndUnvisitedNetworkStorage(em); assertEquals(11, g.getNodes()); PrepareRoutingSubnetworks instance = new PrepareRoutingSubnetworks(g, Collections.singletonList(carFlagEncoder)). setMinOneWayNetworkSize(3); int removed = instance.removeDeadEndUnvisitedNetworks(DefaultEdgeFilter.allEdges(carFlagEncoder)); assertEquals(3, removed); instance.markNodesRemovedIfUnreachable(); g.optimize(); assertEquals(8, g.getNodes()); }