title: Unweighted graphs using Adjacency lists
body: <p>I'm new to programming and trying to learn data structures on my own. I am trying to implement an unweighted graph class using adjacency lists, but I am having trouble implementing the getAdjacentVertices method and I don't exactly know how the addEdge method is really working specially how to implement the insertAtTheBeginning method.Please help me, the book I am using doesn't really explains this topics.*</p>
  
  <pre><code>enter code here
  public class Graph {
      private ArrayList&lt;Integer&gt; vertices;
      private ListNode[] edges;
      private int vertexCount = 0;
      public Graph(int vertexCount){
          this.vertexCount = vertexCount;
          vertices = new ArrayList&lt;Integer&gt;();
          edges = new ListNode[vertexCount];
          for(int i = 0; i &lt; vertexCount; i++){
              vertices.add(i);
              edges[i] = new ListNode ();
           }
      }
      public void addEdge(int source, int destination){
         int i = vertices.indexOf(source);
         int j = vertices.indexOf(destination);
         if(i != -1 || j != -1){
            edges[i].insertAtBeginning(destination);
            edges[j].insertAtBeginning(source);
         }
      }
      public int getNumberVertices() {
         return vertexCount;
      }
      public Object getAdjacentVertices(int currentVertex) {
  
      }
  }
  </code></pre>