Optimize neighbor operations
This changes the neighbor data structure to be a HashSet
instead of an ArrayList
. This optimizes operations like add
, remove
, contains
, etc. This PR also abstracts how neighbors are stored in the Node
class as well as public views of it, getNeighbors()
.