BFS implementation in JAVA import java.util.*;

public class BFS {
    static LinkedList&lt;Node&gt; tracker = new LinkedList&lt;&gt;();
    static Node[] nodes = new Node[]{
            new Node(1),
            new Node(2),
            new Node(3),
            new Node(4),
            new Node(5),
            new Node(6),
    };

    public static void main(String[] args) {

        Map&lt;Node, ArrayList&lt;Edge&gt;&gt; graph = new TreeMap&lt;&gt;();
        graph.put(nodes[3], addEdges(2,3,5,6));
        graph.put(new Node(5), addEdges(3,4,6));
        graph.put(new Node(6), addEdges(4,5));
        graph.put(new Node(1), addEdges(2,3));
        graph.put(new Node(2), addEdges(1,4));
        graph.put(new Node(3), addEdges(1,4,5));

        traverse(graph, nodes[0]);

    }

    private static ArrayList&lt;Edge&gt; addEdges(int... edges) {
        ArrayList&lt;Edge&gt; edgeList = new ArrayList&lt;&gt;(edges.length);
        for(int edge : edges)
            edgeList.add(new Edge(nodes[edge-1]));
        return edgeList;
    }

    static class Node implements Comparable&lt;Node&gt;{
        final int vertex;
        boolean isExplored;

        Node(int vertex) {
            this.vertex = vertex;
        }

        @Override
        public int compareTo(Node node) {
            return this.vertex - node.vertex;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Node)) return false;
            Node node = (Node) o;
            return vertex == node.vertex;
        }

        @Override
        public int hashCode() {
            return Objects.hash(vertex, isExplored);
        }
    }

    static class Edge {
        Node endNode;
        boolean isExplored;
        Edge(Node endPoint) {
            this.endNode = endPoint;
        }
    }

    private static void traverse(Map&lt;Node, ArrayList&lt;Edge&gt;&gt; graph, Node startNode) {
        startNode.isExplored = true;
        tracker.add(startNode);
        System.out.println(&quot;Start Node -&gt; &quot; + startNode.vertex + &quot; (&quot; + startNode.hashCode() + &quot;)&quot;);
        while(!tracker.isEmpty()) {
            Node top = tracker.pop();
            System.out.println(&quot;Top Node -&gt;&quot; + top.vertex + &quot; (&quot; + top.hashCode() + &quot;)&quot;);
            for(Edge edge : graph.get(top)) {
                System.out.println(&quot;About to check Node -&gt;&quot; + edge.endNode.vertex);
                if(!edge.isExplored &amp;&amp; !edge.endNode.isExplored) {
                    edge.endNode.isExplored = true;
                    edge.isExplored = true;
                    tracker.add(edge.endNode);
                    System.out.println(&quot;Marked Node -&gt;&quot; + edge.endNode.vertex);
                }
            }
        }
    }
}

I have implemented BFS can someone please review it and give recommendations. My main concern(but not limitted to) is the way I defined Graph i.e. Node and Edge class isn't a standard way of dealing with graphs.
Data structure
There is no such thing as a &quot;standard graph data structure.&quot; There are a few different data structures for representing a graph and you have implemented the adjacency list. The main problem with your implementation is that you have actually implemented the traversal algorithm and the data structure is just an &quot;accessory&quot; to it. It is not possible to extract the graph from the code and use it somewhere else so there is not much point in spending a lot of time reviewing the graph implementation as a data structure.
I would expect a graph data structrue to be encapsulated in a class named Graph (or an interface named Graph with implementations in classes like AdjacencyListGraph and AdjacencyMatrixGraph). The purpose of the encapsulation is to protect the data structure from manipulation which would break the data structure. For example, as you represent the adjacency as a Map&lt;Node, ArrayList&lt;Edge&gt;&gt; you allow a situation where a single edge could be assigned to two nodes, which would destroy your traversal algorithm.
Your Edge implementation is tightly bound to the traversal algorithm because you have placed the isExplored attribute to it. A pure graph implementation should not be concerned about how it is traversed.