Similar Items: Polygraphic programs and polynomial-time functions