### Question:
QueryGraph implements Graph { @Override public EdgeExplorer createEdgeExplorer( final EdgeFilter edgeFilter ) { if (!isInitialized()) throw new IllegalStateException("Call lookup before using this graph"); final TIntObjectMap<VirtualEdgeIterator> node2EdgeMap = new TIntObjectHashMap<VirtualEdgeIterator>(queryResults.size() * 3); final EdgeExplorer mainExplorer = mainGraph.createEdgeExplorer(edgeFilter); final TIntHashSet towerNodesToChange = new TIntHashSet(queryResults.size()); for (int i = 0; i < queryResults.size(); i++) { VirtualEdgeIterator virtEdgeIter = new VirtualEdgeIterator(2); EdgeIteratorState baseRevEdge = virtualEdges.get(i * 4 + VE_BASE_REV); if (edgeFilter.accept(baseRevEdge)) virtEdgeIter.add(baseRevEdge); EdgeIteratorState adjEdge = virtualEdges.get(i * 4 + VE_ADJ); if (edgeFilter.accept(adjEdge)) virtEdgeIter.add(adjEdge); int virtNode = mainNodes + i; node2EdgeMap.put(virtNode, virtEdgeIter); int towerNode = baseRevEdge.getAdjNode(); if (!isVirtualNode(towerNode)) { towerNodesToChange.add(towerNode); addVirtualEdges(node2EdgeMap, edgeFilter, true, towerNode, i); } towerNode = adjEdge.getAdjNode(); if (!isVirtualNode(towerNode)) { towerNodesToChange.add(towerNode); addVirtualEdges(node2EdgeMap, edgeFilter, false, towerNode, i); } } towerNodesToChange.forEach(new TIntProcedure() { @Override public boolean execute( int value ) { fillVirtualEdges(node2EdgeMap, value, mainExplorer); return true; } }); return new EdgeExplorer() { @Override public EdgeIterator setBaseNode( int baseNode ) { VirtualEdgeIterator iter = node2EdgeMap.get(baseNode); if (iter != null) return iter.reset(); return mainExplorer.setBaseNode(baseNode); } }; } QueryGraph( Graph graph ); private  QueryGraph( Graph graph, QueryGraph superQueryGraph ); QueryGraph lookup( QueryResult fromRes, QueryResult toRes ); void lookup( List<QueryResult> resList ); @Override Graph getBaseGraph(); boolean isVirtualEdge( int edgeId ); boolean isVirtualNode( int nodeId ); boolean enforceHeading( int nodeId, double favoredHeading, boolean incoming ); boolean enforceHeadingByEdgeId( int nodeId, int edgeId, boolean incoming ); void clearUnfavoredStatus(); @Override int getNodes(); @Override NodeAccess getNodeAccess(); @Override BBox getBounds(); @Override EdgeIteratorState getEdgeIteratorState( int origEdgeId, int adjNode ); @Override EdgeExplorer createEdgeExplorer( final EdgeFilter edgeFilter ); @Override EdgeExplorer createEdgeExplorer(); @Override AllEdgesIterator getAllEdges(); @Override EdgeIteratorState edge( int a, int b ); EdgeIteratorState edge( int a, int b, double distance, int flags ); @Override EdgeIteratorState edge( int a, int b, double distance, boolean bothDirections ); @Override Graph copyTo( Graph g ); @Override GraphExtension getExtension();  }### Answer:
@Test public void testVirtEdges() { initGraph(g); EdgeIterator iter = g.createEdgeExplorer().setBaseNode(0); iter.next(); VirtualEdgeIterator vi = new VirtualEdgeIterator(2); vi.add(iter.detach(false)); assertTrue(vi.next()); }