  Homomorphisms between relational structures are not only fundamental
mathematical objects, but are also of great importance in an applied
computational context. Indeed, constraint satisfaction problems (CSPs), a wide
class of algorithmic problems that occur in many different areas of computer
science such as artificial intelligence or database theory, may be viewed as
asking for homomorphisms between two relational structures [FedVar98]. In a
logical setting, homomorphisms may be viewed as witnesses for positive
primitive formulas in a relational language. As we shall see, homomorphisms, or
more precisely the numbers of homomorphisms between two structures, are also
related to a fundamental computational problem of statistical physics.
  In this article, we are concerned with the complexity of counting
homomorphisms from a given structure A to a fixed structure B. Actually, we are
mainly interested in a generalization of this problem to weighted homomorphisms
(or partition functions). We almost exclusively focus on graphs. The first part
of the article is a short survey of what is known about the problem. In the
second part, we give a proof of a theorem due to Bulatov and the first author
of this paper [BulGro05], which classifies the complexity of partition
functions described by matrices with non-negative entries. The proof we give
here is essentially the same as the original one, with a few shortcuts due to
[Thu09], but it is phrased in a different, more graph theoretical language that
may make it more accessible to most readers.
