Fixed RandomAccessFile to deal with duplicates and added hashset to graph to prevent repeated visits to same way