adapting seed algorithm