1 Preliminaries
Let be the set of all unlabeled, finite graphs that may have loops and multiple edges. Let . We denote the vertex set of with , the set of its loops with , the set of its nonloop edges with , and the set of all edges with . Let be the number of homomorphisms from to . Let be the number of automorphisms of . Let be the number of vertexsurjective homomorphisms from to (note that this is different from the notion in [2, 5], where surjectivity has to hold also for edges). Let be the number of “compactions” from to , that is, the number of homomorphisms that are surjective on the vertices and nonloop edges of . For a set , we denote the subgraph of induced by the vertices of with . Let be the number of induced subgraphs of that are isomorphic to . Let be the number of subgraphs isomorphic to that are obtained from by deleting vertices or nonloop edges; that is, we have and , while holds.
Analogous to the setup in [2, Section 3], we view these counting functions as infinite matrices indexed by graphs , which are ordered by their total size . Then and are lower triangular matrices with diagonal entries , and and are upper triangular matrices with s on their diagonals. In particular, these matrices are invertible.
2 Previous results
A graph is called reflexive if all loops are present, and a graph is called irreflexive if it has no loops. Let be the family of all graphs that are disjoint unions of irreflexive bicliques and reflexive cliques.
Theorem (Dyer & Greenhill [3]).
If , then can be computed in polynomial time. Otherwise the problem is hard, even when the input graphs are restricted to be irreflexive.
Let be the family of all graphs that are disjoint unions of irreflexive stars and reflexive cliques of size at most two.
Theorem (Focke, Goldberg, and Živný [4]).
If , then can be computed in polynomial time. Otherwise the problem is hard, even when the input graphs are restricted to be irreflexive.
Theorem (Focke, Goldberg, and Živný [4]).
If , then can be computed in polynomial time. Otherwise the problem is hard, even when the input graphs are restricted to be irreflexive.
3 Proof of weaker versions of Theorems 2 and 2
In this section, we establish the algorithms of Theorems 2 and 2, and prove the weaker version of the hardness claims by a reduction from Theorem 2; that is, our reduction produces input graphs that may have loops. Every homomorphism from to is vertexsurjective on its image under , so the following identities hold:
(1)  
(2) 
The second equation is the inversion of the first one, and one way to obtain it is by an application of the principle of inclusion and exclusion. (Another way is to observe that (1) is equivalent to the matrix identity analogously to how this was done in [2, Section 3]; inverting yields the matrix identity that is equivalent to (2)). For compactions we get similar identities from the fact the every homomorphism from to is a compaction to a subgraph of obtained by deleting vertices and nonloop edges. We obtain , and we expand this equation and its inversion for convenience. For all , we have:
(3)  
(4) 
Note that the sum in (3) is indeed finite since holds only for finitely many graphs , namely certain subgraphs of . Since is an infinite upper triangular matrix with s on its diagonal, it has an inverse matrix , which is also upper triangular with s on its diagonal, and so holds only if , and the sum in (4) is also finite.
3.1 Algorithms
The algorithms for Theorems 2 and 2 immediately follow from (2) and (4) since we want to compute the left sides of the equations and can, respectively, compute the right sides in polynomial time using Theorem 2. For the case of , note that deleting any vertices of again yields a graph in . For the case of , note that deleting any vertices and nonloop edges of yields a graph , and that holds. (Indeed, is the unique maximal subset of that is closed under taking subgraphs in the sense of .)
3.2 Hardness
We use two ingredients. The first is the following fact for the disjoint union [5, (5.28)].
(5) 
The second is the following lemma proved by Lovász.
Lemma (Proposition 5.43 in [5]).
Let be a finite set of unlabeled graphs that is closed in the sense that, for all , the set contains all homomorphic images of . Then the matrix with is invertible.
The following lemma is completely analogous to its dual version in [2, Lemma 3.6].
Lemma.
Let be a function of finite support and let be the graph parameter with
(6) 
When given oracle access to , we can compute in polynomial time for all .
Proof.
Let be the support of , that is, the set of all graphs with . Let be the set of all homomorphic images of graphs in . For each , we have:
(7) 
We define a vector
with . Let be the matrix with . By the previous lemma, this matrix is invertible. Finally, let be the vector with . Then can be written as the matrixvector product: . Thus we have . The vector can be computed in polynomial time by querying the oracle for the values . The matrix can be computed in constant time since it only depends on the fixed function . Thus we can compute the entire vector . In particular, for each , we can determine via the identity since .Applying this lemma to and yields the hardness of Theorems 2 and 2. The reason is that both functions can written as a linear combination of via (2) and (4), and in both cases a counting function that is hard by Theorem 2 appears in the support of .
For Theorem 2, note that satisfies since is the only term in (1) where is isomorphic to . Thus if , then is hard by Theorem 2, and so is hard by Lemma 3.2.
For Theorem 2, recall that holds. Thus if , then is hard by Theorem 2 and it reduces to by Lemma 3.2, so the latter is hard as well. Now suppose . Then there is a nonloop edge such that . Clearly is hard by Theorem 2. It remains to show that so that Lemma 3.2 reduces to . Using the fact that and are upper triangular matrices and that
is the infinite identity matrix, we have:
This implies as required.
Acknowledgments.
I thank Jacob Focke, Leslie Ann Goldberg, and Standa Živný for comments on an earlier version of this note, and for subsequent discussions at the Dagstuhl Seminar 17341 on “Computational Counting” in August 2017. I thank Radu Curticapean and Marc Roth for many discussions and comments.
References
 [1] Hubie Chen. Homomorphisms are indeed a good basis for counting: Three fixedtemplate dichotomy theorems, for the price of one. CoRR, abs/1710.00234, 2017. URL: https://arxiv.org/abs/1710.00234.

[2]
Radu Curticapean, Holger Dell, and Dániel Marx.
Homomorphisms are a good basis for counting small subgraphs.
In Hamed Hatami, Pierre McKenzie, and Valerie King, editors,
Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 1923, 2017
, pages 210–223. ACM, 2017. URL: http://doi.acm.org/10.1145/3055399.3055502, doi:10.1145/3055399.3055502.  [3] Martin E. Dyer and Catherine S. Greenhill. The complexity of counting graph homomorphisms. Random Struct. Algorithms, 17(34):260–289, 2000. URL: https://doi.org/10.1002/10982418(200010/12)17:3/4<260::AIDRSA5>3.0.CO;2W, doi:10.1002/10982418(200010/12)17:3/4<260::AIDRSA5>3.0.CO;2W.
 [4] Jacob Focke, Leslie Ann Goldberg, and Stanislav Zivny. The complexity of counting surjective homomorphisms and compactions. CoRR, abs/1706.08786, 2017. URL: http://arxiv.org/abs/1706.08786.
 [5] László Lovász. Large networks and graph limits, volume 60. American Mathematical Society Providence, 2012.