using hashmap as adjacency list