Can you add some comments on the algorithm itself? 

And re performance, the hash set might not be the most efficient way to handle this, because it always allocate 64 as initial size. In any graph, the number of neighbors on average is probably much, much smaller than 64.