

public class Graph<T> {
  HashMap<T, Integer> indicies;
  ArrayList<Node> g;

  public Graph() {
    this.indicies = new HashMap<T, Integer>();
    this.g = new ArrayList<ArrayList<Integer>>();
  } 

  public boolean has(T v) {
    return this.indicies.containsKey(v);
  }

  public boolean addEdge(T start, T end) {
    if (this.has(start) && this.has(end)) {
      
      int startI = this.indicies.get(start);
      int endI = this.indicies.get(end);

      this.setEdge(start, endI);
      this.setEdge(end, startI);
      
    }
    return false;
  }

  public boolean hasEdge(T start, T end) {
    return this.vertexHasEdge(start, end)
      && this.vertexHasEdge(end, start);
  }

  private void setEdge(T start, int endI) {
    this.getVertex(start).edges.add(endI);
  }
  
  private boolean vertexHasEdge(T start, T end) {
    this.getVertex(start).edges.contains(this.indicies.get(end));
  }
  
  public boolean addVertex(T v) {
    Node newVertex;
    int indexOf;
    
    if (!this.has(v)) {

      // Create our new node and add it to the graph
      newVertex = new Node(v);
      this.g.add(newVertex);
      // Store the index of this node for quick retrieval later
      this.indicies.put(v, this.g.indexOf(newVertex));
      
      return true;
    }
    return false;
  }

  /***
   * Private helper functions
   */
  
  private Node getVertex(T value) {
    return this.g.get(this.indicies.get(value));
  }
}

class Node<T> implements {
  T value;
  ArrayList<Integer> edges;

  public Node() {
    this.value = -1;
    this.edges = new ArrayList<Integer>();
  }
}

@@ -1,24 +1,19 @@
 %0A%0A
-public class Graph
+class AdjList
 %3CT%3E 
@@ -41,17 +41,16 @@
 r%3E indic
-i
 es;%0A  Ar
@@ -80,13 +80,15 @@
 lic 
-Graph
+AdjList
 () %7B
@@ -102,17 +102,16 @@
 is.indic
-i
 es = new
@@ -187,17 +187,16 @@
 %3E();%0A  %7D
- 
 %0A%0A  publ
@@ -238,17 +238,16 @@
 is.indic
-i
 es.conta
@@ -313,24 +313,25 @@
     if (
+!
 this.has
 (start) 
@@ -326,36 +326,28 @@
 .has
+Edge
 (start
-) && this.has(
+, 
 end)) %7B%0A
     
@@ -342,22 +342,16 @@
 end)) %7B%0A
-      
 %0A      i
@@ -368,25 +368,24 @@
 = this.indic
-i
 es.get(start
@@ -406,33 +406,32 @@
 ndI = this.indic
-i
 es.get(end);%0A%0A  
@@ -494,22 +494,16 @@
 tartI);%0A
-      
 %0A    %7D%0A 
@@ -742,26 +742,24 @@
 (endI);%0A  %7D%0A
-  
 %0A  private b
@@ -793,32 +793,39 @@
 t, T end) %7B%0A    
+return 
 this.getVertex(s
@@ -851,25 +851,24 @@
 s(this.indic
-i
 es.get(end))
@@ -873,18 +873,16 @@
 ));%0A  %7D%0A
-  
 %0A  publi
@@ -932,29 +932,8 @@
 ex;%0A
-    int indexOf;%0A    
 %0A   
@@ -1147,17 +1147,16 @@
 is.indic
-i
 es.put(v
@@ -1185,22 +1185,16 @@
 rtex));%0A
-      
 %0A      r
@@ -1238,54 +1238,8 @@
  %7D%0A%0A
-  /***%0A   * Private helper functions%0A   */%0A  %0A
   pr
@@ -1302,17 +1302,16 @@
 is.indic
-i
 es.get(v
@@ -1342,19 +1342,8 @@
 e%3CT%3E
- implements
  %7B%0A 
@@ -1395,16 +1395,19 @@
 ic Node(
+T v
 ) %7B%0A    
@@ -1423,10 +1423,9 @@
 e = 
--1
+v
 ;%0A  

Fix typo