update frontier and adjacent