finish the implement of graph using adjacency list