On recognizing graphs by numbers of homomorphisms