Is something missing in this EXPLORE algorithm?
This might be a bit too much, but I tried the best I could to condense it.  Unfortunately, Java doesn't allow one to write concise code...  So, here's breadth-first and depth-first traversal of a graph (I used JGraphT) library for graph implementation.  This should better illustrate the idea.

package tld.se.doodles;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.DefaultDirectedGraph;

public class GraphSearch {

    public static void main(String ...args) {
        DefaultDirectedGraph&lt;Integer, DefaultEdge&gt; graph =
                new DefaultDirectedGraph&lt;&gt;(DefaultEdge.class);
        int[][] vertices = {
            {1, 2}, {1, 3}, {2, 1}, {2, 3},
            {3, 5}, {3, 6}, {3, 4}, {4, 7},
            {5, 2}, {5, 6}, {6, 3}, {6, 7}
        };
        Arrays.stream(vertices)
                .forEach(pair -&gt; {
                        graph.addVertex(pair[0]);
                        graph.addVertex(pair[1]);
                        graph.addEdge(pair[0], pair[1]);
                    });
        depthFirstTraversal(graph);
        breadthFirstTraversal(graph);
    }

    private static void depthFirstTraversal(
        DefaultDirectedGraph&lt;Integer, DefaultEdge&gt; graph) {
        System.out.println("Depth-first traversal");
        HashSet&lt;Integer&gt; cache = new HashSet&lt;&gt;();
        Integer start = graph.vertexSet().stream().findFirst().get();
        dftHashed(start, graph, cache);
    }

    private static void dftHashed(
        Integer from, DefaultDirectedGraph graph, HashSet cache) {
        if (!cache.contains(from)) {
            cache.add(from);
            System.out.format("Visiting: %d%n", from);
            graph.&lt;DefaultEdge&gt;edgesOf(from).stream()
                    .forEach(edge -&gt;
                             dftHashed((Integer)graph.getEdgeTarget(edge),
                                       graph, cache));
        }
    }

    private static void breadthFirstTraversal(
        DefaultDirectedGraph&lt;Integer, DefaultEdge&gt; graph) {
        System.out.println("Breadth-first traversal");
        HashSet&lt;Integer&gt; cache = new HashSet&lt;&gt;();
        Integer start = graph.vertexSet().stream().findFirst().get();
        HashSet&lt;Integer&gt; firstGen = new HashSet&lt;&gt;();
        firstGen.add(start);
        bftHashed(firstGen, graph, cache);
    }

    private static void bftHashed(
        HashSet previous, DefaultDirectedGraph graph, HashSet cache) {
        cache.addAll(previous);
        HashSet&lt;Integer&gt; next = (HashSet&lt;Integer&gt;)previous.stream()
                .flatMap(vertex -&gt; {
                        System.out.format("Visiting: %d%n", vertex);
                        return graph.&lt;DefaultEdge&gt;edgesOf(vertex)
                            .stream().map(graph::getEdgeTarget);
                    })
                 .collect(Collectors.toCollection(HashSet::new));
        next.removeAll(cache);
        if (!next.isEmpty()) bftHashed(next, graph, cache);
    }
}