updated graph.java