use hash map to store edges