  Color Refinement, also known as Naive Vertex Classification, is a classical
method to distinguish graphs by iteratively computing a coloring of their
vertices. While it is mainly used as an imperfect way to test for isomorphism,
the algorithm permeated many other, seemingly unrelated, areas of computer
science. The method is algorithmically simple, and it has a well-understood
distinguishing power: It is logically characterized by Cai, F\"urer and
Immerman (1992), who showed that it distinguishes precisely those graphs that
can be distinguished by a sentence of first-order logic with counting
quantifiers and only two variables. A combinatorial characterization is given
by Dvo\v{r}\'ak (2010), who shows that it distinguishes precisely those graphs
that can be distinguished by the number of homomorphisms from some tree.
  In this paper, we introduce Relational Color Refinement (RCR, for short), a
generalization of the Color Refinement method from graphs to arbitrary
relational structures, whose distinguishing power admits the equivalent
combinatorial and logical characterizations as Color Refinement has on graphs:
We show that RCR distinguishes precisely those structures that can be
distinguished by the number of homomorphisms from an acyclic relational
structure. Further, we show that RCR distinguishes precisely those structures
that can be distinguished by a sentence of the guarded fragment of first-order
logic with counting quantifiers.
