@Override
    public void start(EdgeExplorer explorer, int startNode) {
        IntArrayDeque stack = new IntArrayDeque();

        GHBitSet explored = createBitSet();
        stack.addLast(startNode);
        int current;
        while (stack.size() > 0) {
            current = stack.removeLast();
            if (!explored.contains(current) && goFurther(current)) {
                EdgeIterator iter = explorer.setBaseNode(current);
                while (iter.next()) {
                    int connectedId = iter.getAdjNode();
                    if (checkAdjacent(iter)) {
                        stack.addLast(connectedId);
                    }
                }
                explored.add(current);
            }
        }
    }
@Test
    public void testDFS1() {
        DepthFirstSearch dfs = new DepthFirstSearch() {
            @Override
            protected GHBitSet createBitSet() {
                return new GHBitSetImpl();
            }

            @Override
            public boolean goFurther(int v) {
                counter++;
                assertTrue(!set.contains(v), "v " + v + " is already contained in set. iteration:" + counter);
                set.add(v);
                list.add(v);
                return super.goFurther(v);
            }
        };

        BooleanEncodedValue accessEnc = new SimpleBooleanEncodedValue("access", true);
        EncodedValue.InitializerConfig evConf = new EncodedValue.InitializerConfig();
        accessEnc.init(evConf);
        BaseGraph g = new BaseGraph.Builder(evConf.getRequiredBytes()).create();
        g.edge(1, 2).setDistance(1).set(accessEnc, true, false);
        g.edge(1, 5).setDistance(1).set(accessEnc, true, false);
        g.edge(1, 4).setDistance(1).set(accessEnc, true, false);
        g.edge(2, 3).setDistance(1).set(accessEnc, true, false);
        g.edge(3, 4).setDistance(1).set(accessEnc, true, false);
        g.edge(5, 6).setDistance(1).set(accessEnc, true, false);
        g.edge(6, 4).setDistance(1).set(accessEnc, true, false);

        dfs.start(g.createEdgeExplorer(AccessFilter.outEdges(accessEnc)), 1);

        assertTrue(counter > 0);
        assertEquals(list.toString(), "[1, 2, 3, 4, 5, 6]");
    }