added search after random test
added optimal degree method