basic implementation for graph using a hashmap