title: How can I implement a Breadth first search of a graph using Java?
body: <p>I need to do this using a text file which contains a linked list  of the graph which would be,
   (AEDB),
    (EA),
   (DA),
  (BAC), 
   (CB), 
  Then I ask the user for the node to start at and then the BFS order prints?
  I know one way to start would be to create a linked list then hash the linked list in a dictionary but don't know from there on, also a node can't be visited more than once. My linked list is something like,
              HashMap> L = new HashMap>();</p>
  
  <pre><code>    LinkedList&lt;String&gt; listA = new LinkedList&lt;String&gt;();
      listA.add("B"); 
      listA.add("E");
  
      L.put("A", listA);
  
      LinkedList&lt;String&gt; listB = new LinkedList&lt;String&gt;();
      listB.add("A");
      listB.add("C");
      listB.add("F");
  
      L.put("B", listB);
  
      LinkedList&lt;String&gt; listE = new LinkedList&lt;String&gt;();
      listE.add("A");
      listE.add("F");
  
      L.put("E", listE);
  
      LinkedList&lt;String&gt; listF = new LinkedList&lt;String&gt;();
      listF.add("E");
      listF.add("K");
      listF.add("B");
  
      L.put("F", listF);
  
      LinkedList&lt;String&gt; listK = new LinkedList&lt;String&gt;();
      listK.add("F");
      listK.add("C");
  
      L.put("K", listK);
  
      LinkedList&lt;String&gt; listC = new LinkedList&lt;String&gt;();
      listC.add("K");
      listC.add("B");
  
      L.put("C", listC);
  </code></pre>
  
  <p>The output would print the nodes starting from the user inputted one in a breadth first order, but this is as far as I have gotten</p>