add random graph logic