/** * Retrieves vertex from the {@code bucketList} and returns it. * * @return the vertex retrieved from the {@code bucketList}. */ private V advance() { V vertex = bucketList.poll(); if (vertex != null) { bucketList.updateBuckets(getUnvisitedNeighbours(vertex)); } return vertex; }