Improved drunkards walk with edge detection