modified graph.go