update Graph.java and related classes