def add(frame)
      return false if max_size && queue.length >= max_size
      return false if seen.include?(frame.gid)

      seen.add(frame.gid)
      idx = random_idx ? rand(queue.length + 1) : queue.length
      queue.insert(idx, frame)

      true
    end
def add(frame)
      return false if max_size && queue.length >= max_size
      return false if seen.include?(frame.gid)

      seen.add(frame.gid)
      idx = random_idx ? rand(queue.length + 1) : queue.length
      queue.insert(idx, frame)

      true
    end
Initialize a new Queue.

 max_size:   - The maximum size the queue can grow to. This helps when
               walking a large graph by forcing us to walk deeper.
 random_idx: - Add frames to the queue at random indicies. This helps when
               walking a large graph by forcing us to walk deeper.

 Returns nothing.
 Add a frame to the queue if its GID hasn't been seen already and the queue
 hasn't exceeded its max size.

 frame - The Frame to add to the queue.

 Returns true if the frame was added, false otherwise.