Find Local Min And Max Of A Graph