using edges to find max movement