title: How do I implement a Bipartite Graph in Java?
body: <h2>UPDATE</h2>
  
  <p>Some answers so far have suggested using an adjacency list. How would an adjacency list look like in Java? ... no pointers right :)</p>
  
  <hr>
  
  <p>I'm trying to implement a Bipartite Graph in Java to sort into 2 groups information from a file. I found this example and it actually does the job:</p>
  
  <p><a href="http://users.skynet.be/alperthereal/source_files/html/java/Bipartite.java.html" rel="nofollow noreferrer">http://users.skynet.be/alperthereal/source_files/html/java/Bipartite.java.html</a></p>
  
  <p>However, I would like to implement my own version... if you look at a <a href="https://stackoverflow.com/questions/3345611/data-structures-so-how-do-i-understand-them">previous post of mine</a>, you'd understand why I want to do this myself. </p>
  
  <p>So I have to read a file from which I can get the number of vertices easily, but the number of edges not so easily. An example line would be <strong>"PersonA PersonB"</strong>, which can be read as <strong>"PersonA says PersonB"</strong>. So reading these lines...</p>
  
  <pre><code>"A says B"
  "C says B"
  "D says B"
  "B says D"
  "E says A &amp; C"
  </code></pre>
  
  <p>... produces this grouping:</p>
  
  <pre><code>{A,D,C} and {B,E}.
  </code></pre>
  
  <p>How would I go about implementing this bipartite graph? What is a good resource for this task? What things (algorithms) should I be considering and thinking about when creating the BipartiteGraph class... perhaps traversing/sorting algorithms?</p>