added min and avg neighbor algorithms