Abstract 1 Introduction 2 Preliminaries 3 Restricted constraint satisfaction problems 4 Finite domain restrictions 5 Homomorphism-free restrictions 6 Acyclic digraphs and bounded paths 7 Digraphs on three vertices 8 A family of smooth tournaments 9 Omitting a single digraph 10 Conclusion and outlook References

Restricted CSPs and F-Free Digraph Algorithmics

Santiago Guzmán-Pro ORCID Institut für Algebra, TU Dresden, Germany Barnaby Martin ORCID Department of Computer Science, Durham University, UK
Abstract

In recent years, much attention has been placed on the complexity of graph homomorphism problems when the input is restricted to k-free and k-subgraph-free graphs. We consider the directed version of this research line, by addressing the question is it true that digraph homomorphism problems CSP() have a P versus NP-complete dichotomy when the input is restricted to k-free (resp. k-subgraph-free) digraphs? Our main contribution in this direction shows that if CSP() is NP-complete, then there is a positive integer N such that CSP() remains NP-hard even for N-subgraph-free digraphs. Moreover, CSP() becomes polynomial-time solvable for N1-subgraph-free acyclic digraphs. We then verify the questions above for digraphs on three vertices and a family of smooth tournaments. We prove these results by establishing a connection between 𝔽-(subgraph)-free algorithmics and constraint satisfaction theory. On the way, we introduce restricted CSPs, i.e., problems of the form CSP() restricted to yes-instances of CSP() – these were called restricted homomorphism problems by Hell and Nešetřil. Another main result of this paper presents a P versus NP-complete dichotomy for these problems. Moreover, this complexity dichotomy is accompanied by an algebraic dichotomy in the spirit of the finite domain CSP dichotomy.

Keywords and phrases:
Digraph homomorphisms, constraint satisfaction problems, subgraph-free algorithmics
Category:
Track B: Automata, Logic, Semantics, and Theory of Programming
Funding:
Santiago Guzmán-Pro: Funded by the European Research Council (Project POCOCOP, ERC Synergy Grant 101071674). Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.
Barnaby Martin: Funded by EPSRC Grant EP/X03190X/1.
Copyright and License:
[Uncaptioned image] © Santiago Guzmán-Pro and Barnaby Martin; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Graph theory
; Theory of computation Graph algorithms analysis ; Theory of computation Logic
Related Version:
Full Version: https://arxiv.org/abs/2502.17596 [19]
Editors:
Keren Censor-Hillel, Fabrizio Grandoni, Joël Ouaknine, and Gabriele Puppis

As little as a few years ago, most graph theorists, while passively aware of a few classical results on graph homomorphisms, would not include homomorphisms among the topics of central interest in graph theory. We believe that this perception is changing, principally because of the usefulness of the homomorphism perspective… At the same time, the homomorphism framework strengthens the link between graph theory and other parts of mathematics, making graph theory more attractive, and understandable, to other mathematicians. Pavol Hell and Jaroslav Nešetřil, Graphs and Homomorphisms, 2004 [21].

1 Introduction

Story of the main questions

The Hell-Nešetřil theorem asserts that if is a finite undirected graph, then CSP() is polynomial-time solvable whenever is either a bipartite graph or contains a loop, and otherwise CSP() is NP-complete. In recent years, much attention has been placed on the complexity of graph homomorphism problems when the input is restricted to 𝔽-free and 𝔽-subgraph-free graphs, i.e., to graphs avoiding 𝔽 as an induced subgraph, and as a subgraph, respectively. In [17], the authors show that CSP(5) is polynomial-time solvable when the input is restricted to 8-free graphs. Moreover, they show that there are finitely many 8-free obstructions to CSP(5). Also, in [8] the authors prove that CSP(𝕂3) becomes tractable if the input is restricted to 7-free graphs, while Huang [22] proved that CSP(𝕂4) remains NP-hard even for 7-free graphs. In general, several complexity classifications are known for CSP(𝕂n) with input restriction to k-free graphs (see, e.g., [18, Theorem 7]), however, a complete complexity classification of graph colouring problems with input restriction to 𝔽-(subgraph)-free graphs remains wide open.

The finite domain CSP dichotomy [28] (announced independently by Bulatov [11] and Zhuk [27]) asserts that digraph colouring problems also exhibit a P versus NP-complete dichotomy. In this paper we consider the directed version of the research line described above, where we consider the following to be the long-term question of this variant: Is there a P versus NP-complete dichotomy of CSP() where the input is restricted (1) to 𝔽-free digraphs? and (2) to 𝔽-subgraph-free digraphs?111Note that a negative answer to any of these questions implies that if PNP, then there are finite digraphs 𝔽 and such that CSP() restricted to 𝔽-free digraphs is NP-intermediate – which we believe to be a more natural problem than the current NP-intermediate problems constructed in the literature. At this point we do not conjecture either a positive or a negative answer to the previous questions.

The Sparse Incomparability Lemma [24] asserts that if CSP() is NP-hard, then it remains NP-hard even for high-girth digraphs. Hence, both questions above have a positive answer whenever 𝔽 is not an oriented forest. Motivated by the literature on graph colouring problems restricted to k-free and k-subgraph-free digraphs, we consider the restriction of these questions to the case when F is a directed path k.

Question 1.

Is there a P versus NP-complete dichotomy of CSP() where the input is restricted

  1. 1.

    to k-free digraphs?

  2. 2.

    to k-subgraph-free digraphs?

In our effort to settle Question 1 we stumble into three more questions which we also address in this paper. Allow us to elaborate. Clearly, if CSP() if NP-hard even for k-subgraph-free digraphs, then CSP() is NP-hard for k-free digraphs. In turn, if CSP() restricted to k-homomorphism-free digraphs is NP-hard, then CSP() restricted to k-subgraph-free digraphs is NP-hard as well. It is well-known that a digraph 𝔻 is k-homomorphism-free if and only if 𝔻 homomorphically maps to the transitive tournament in k1 vertices 𝕋k1 (see, e.g, Observation 6). Hence, a simple way to find complexity lower bounds to the problems in Question 1 is to consider the complexity of CSP() restricted to CSP(𝕋k).

The last problems have the following natural generalization: decide CSP() restricted to input digraphs 𝔻 in CSP(). We denote this problem by RCSP(,). These problems have been called restricted homomorphism problems [10, 9] and it was conjectured by Hell and Nešetřil that when and are undirected graphs, then , or is bipartite, and in these cases CSP() restricted to CSP() is in P; and otherwise it is NP-hard. This was later confirmed by Brewster and Graves [9], where they actually propose a hardness condition for a broader family of digraphs (see Theorem 5 below). It is then natural to ask our second main question.

Question 2.

Is there a P versus NP-hard dichotomy of problems RCSP(,) parametrized by finite digraphs (structures) and ?

Clearly, every digraph 𝔻 that admits a homomorphism to some transitive tournament must be an acyclic digraph. A natural question of a digraph , for which CSP() is NP-complete, is to ask if this problem remains NP-complete on acyclic instances. Notice that this is the same problem as RCSP(,(,<)). If is an undirected graph, then of course this will be true (choose any total order of the vertex set and orient the edges according to this ordering). However, when is an arbitrary digraph, the situation is not a priori clear. Indeed, it is addressed for some small digraphs by Hell and Mishra in [20]. They prove, for example, that CSP(3+) – where 3+ is drawn in the forthcoming Figure 4 – does indeed remain NP-complete on acyclic inputs. The general question is not posed in [20], but it is perfectly natural, and we address it here.

Question 3.

If CSP() is NP-hard for a finite graph , does CSP() remain NP-hard for acyclic instances? Equivalently, is RCSP(,(,<)) NP-hard whenever CSP() is NP-hard?

Some readers might have already noticed that there is a third natural question motivated by the previous paragraph: is there a P versus NP-complete dichotomy of CSP() restricted to k-homomorphism-free digraphs? Or more generally: is there a P versus NP-hard dichotomy of CSP() where the input is restricted to -homomorphism-free digraphs? (where is a fixed finite set of digraphs). This question can already be settled from results in the literature: every such problem can be coded into monotone monadic strict NP (MMSNP), and Feder and Vardi [14] proved that if finite domain CSPs have a P versus NP-complete dichotomy, then MMSNP exhibits the same dichotomy. However, we provide an alternative prove of this fact in Section 5.

Story of the paper

Our paper splits into two parts. The first part focuses on relational structures, of which digraphs are somewhat canonical examples, while the second part focuses on digraphs specifically. In Figure 1 we depict the flow of ideas and results of this paper.

Within the first part (Sections 35), we begin by introducing restricted CSPs (RCSPs) which have been studied as restricted homomorphism problems in [10, 9]. In particular, we elaborate a connection with promise CSPs (PCSPs) that enables one to view RCSPs as PCSPs.

Our first main result shows that, for every pair of finite digraphs (structures), 𝔸 and 𝔹 the problem CSP(𝔹) with input restricted to CSP(𝔸) is either in P or NP-hard (settling Question 2). Moreover, this complexity classification is accompanied with an algebraic dichotomy (Theorem 18) which stems from the finite domain CSP dichotomy result. We push the previous complexity dichotomy to finite domain CSPs with restrictions in GMSNP (guarded monotone strict NP[19, Section 4.4]. Another contribution of this work builds again on the finite domain CSP dichotomy to present a new proof of the complexity dichotomy for finite domain CSP restricted to -homomorphism-free digraphs (structures): we avoid going via MMSNP to the infinite domain CSP setting, and stay in the finite domain world via Lemma 21 (Section 5).

In the second part of the paper (Sections 69), we leverage results from the first part, in order to study digraph CSPs, where the ultimate focus will be on 𝔽-free and 𝔽-subgraph-free algorithmics.

Our second main result shows that, if is a digraph and CSP() is NP-complete, then there is a positive integer N such that CSP() remains NP-complete even for N-subgraph-free acyclic inputs (settling Question 3). Moreover, N can be chosen so that CSP() is polynomial-time solvable for N1-subgraph-free acyclic inputs. This also yields a partial answer to Question 1: for every digraph there is a positive integer N4|H| such that Question 1 has a positive answer restricted to kN. We complement this general partial answer by settling Question 1 for digraphs on three vertices (Theorems 31 and 32), and for a family of smooth tournaments 𝕋n (Theorems 33 and Theorem 34). We note that eventual hardness on N-subgraph-free instances does not hold in general for CSP(), if is an infinite digraph. We provide a counterexample (Example 27) which is otherwise well-behaved (for example, by being ω-categorical). As byproducts of our work we see that there are finitely many minimal 3-obstructions to CSP(𝕋n) for each positive integer n [19, Theorem 55], and if 𝔽 is not an oriented path, then CSP(𝕋n) (and CSP(3+)) is NP-hard even for 𝔽-subgraph-free instances (Theorem 36).

Figure 1: A depiction of the flow between main results and main questions addressed in this paper. Rectangles with rounded corners mark the main questions considered here. Dotted squares indicate the (simple) remarks connecting the -subgraph-free CSPs to the theory of digraph homomorphisms. Solid rectangles with straight corners indicate the main results of the present paper. A solid (resp. dashed) edge between a question and a result indicates that the result provides an answer (resp. a partial answer) to the corresponding question. Finally, edges between results represent that the result at the head is proved using tools introduced while proving the result at the tail of the corresponding edge.

2 Preliminaries

2.1 Relational structures and digraphs

For a finite relational signature τ=(R1,,Rk), a relational (τ-)structure 𝔸 on domain A consists of k relations R1Aa1, …, RkAak, where ai is the arity of Ri. We denote the cardinality of A as |A|. We tend to conflate the relation symbol and actual relation since this will not introduce confusion.

For some signature τ, the loop 𝕃 is the structure on one element a all of whose relations are maximally full, that is, contains one tuple (a,,a) – the structure 𝕃 clearly depends on the signature τ, but in this work τ will always be clear from context.

Directed graphs (digraphs) 𝔻 are relational structures on the signature {E} where E is a binary relation. A digraph is a graph if E is symmetric, i.e. (x,y)E iff (y,x)E. We will use the same blackboard font notation for digraphs as we do for relational structures.

Given a positive integer k we denote by k the directed cycle on k vertices, by k the directed path on k vertices, by 𝕋k the transitive tournament on k vertices. Similarly we denote by 𝕂k the complete graph on k vertices, and we think of it as a digraph with edges (i,j) for every ij.

A (directed) walk on a (directed) graph 𝔻 is a sequence of vertices x1,,xk such that for every i[k1] there is a (directed) edge (xi,xi+1)E. An oriented graph is a digraph with no pair of symmetric edges, i.e., a loopless 𝕂2-free digraph.

A tree is an oriented digraph whose underlying graph has no cycle (equivalently, is an orientation of a traditional undirected tree). It follows that trees are 𝕂2-free. A forest is a disjoint union of trees. A structure 𝔸 is a core if all of its endomorphisms are self-embeddings. If 𝔸 is finite then this is equivalent to all endomorphisms being automorphisms.

2.2 Constraint satisfaction problems

Given a pair of digraphs 𝔻 and a homomorphism f:𝔻 is a vertex mapping such that, for every (u,v) that is an edge of 𝔻, the image (f(u),f(v)) is an edge of . If such a homomorphism exists, we write 𝔻, and otherwise 𝔻↛. We follow the notation of constraint satisfaction theory, and denote by CSP() the class of finite digraphs such that 𝔻. We also denote by CSP() the computational problem of deciding if an input digraph 𝔻 belongs to CSP().

The finite-domain CSP dichotomy is commonly stated in terms of polymorphisms. A polymorphism of a structure 𝔸 is a homomorphism f:𝔸n𝔸, and in this case we say that f is an n-ary polymorphism. A 4-ary polymorphism f:𝔸4𝔸 satisfies the Sigger’s identity if

f(x1,x2,x3,x1)=f(x2,x1,x2,x3) for every x1,x2,x3,x4A.

The Sigger’s identity is one of several identities that equivalently describe the tractability frontier for finite domain CSPs.

Theorem 4 (Equivalent to Theorem 1.4 in [28]).

For every finite structure 𝔸 one of the following holds.

  • Either 𝔸 has a polymorphism f:𝔸4𝔸 that satisfies the Sigger’s identity, and in this case CSP(𝔸) is polynomial-time solvable, or

  • otherwise, 𝔸 pp-constructs 𝕂3, and in this case CSP(𝔸) is NP-complete.

2.3 Smooth digraphs

A digraph 𝔻 is smooth if it has no sources nor sinks. A digraph is hereditarily hard if CSP() is NP-complete for every loopless digraph such that . Bang-Jensen, Hell, and Niven conjectured that a smooth digraph is hereditarily hard whenever does not homomorphically map to a disjoint union of directed cycles [2, Conjecture 2.5], and this was later confirmed by Barto, Kozik, and Niven proved in [4]. As far as we are aware, the most general result regarding hardness of restricted CSP problems is Theorem 3 in [9].

Theorem 5 (Theorem 3 in [9]).

If is a hereditarily hard digraph and is a finite digraph such that ↛ then RCSP(,) is NP-hard.

2.4 Duality pairs

A pair of digraphs (relational structure) (𝕋,𝔻𝕋) are called a duality pair if for every digraph 𝔻 it is the case that 𝔻𝔻𝕋 if and only if 𝕋↛𝔻. It was proved in [25] that for every tree 𝕋 there is a digraph 𝔻𝕋 such that (𝕋,𝔻𝕋) is a duality pair. Moreover, they also proved that if (𝕋,𝔻𝕋) is a duality pair, then 𝕋 is homomorphically equivalent to a tree. A well-known example of a family of duality pairs is the following one.

Observation 6.

For every positive integer k the directed path k+1 together with the transitive tournament 𝕋k are duality pair.

Given a set of digraphs , we denote by Forb() the set of digraphs 𝔻 such that 𝔽↛𝔻 for every 𝔽. It is straightforward to observe that for any such set , there is a (possibly infinite) digraph 𝔻 such that Forb()=CSP(𝔻). A generalized duality is a pair (,𝒟) of finite sets of digraphs such that Forb()=𝔻𝒟CSP(𝔻). When 𝒟={𝔻} we simply write (,𝔻). In particular, for every set of trees there is a digraph 𝔻 such that (,𝔻) is a generalized duality [16, Theorem 11].

2.5 Large girth

A well-known result from Erdős [13] about k-colourabilty states that for every pair of positive integers l,k there is a graph G with girth strictly larger than l and such that G does not admit a proper k-colouring. This result generalizes to arbitrary relational structures, and it is known as the Sparse Incomprability Lemma [24] – in order to stay within the scope of this paper, we state it for digraphs.

Given a digraph (structure) 𝔻, the incidence graph of 𝔻 is the undirected bipartite graph 𝕀(𝔻) with vertex set VE, for vD a vertex of D and e=(x,y)E an edge of D. There is an (undirected) edge (v,e) in 𝕀(𝔻) if and only if v{x,y}. The girth of 𝔻 is half the length of the shortest cycle in 𝕀(𝔻). Notice that if 𝔻 has a pair of symmetric arcs, its girth is 2, and otherwise, it is the graph theoretic girth of the underlying graph of 𝔻.

Theorem 7 (Sparse Incomparability Lemma [24]).

For every digraph 𝔻 and every pair of positive integers k and there is a digraph 𝔻 with the following properties:

  • 𝔻𝔻,

  • the girth of 𝔻 is larger than ,

  • 𝔻 if and only if 𝔻 for every digraph on at most k vertices,

  • 𝔻 can be constructed in polynomial time (from 𝔻).

3 Restricted constraint satisfaction problems

Promise problems (not to be confused with Promise CSPs) can be thought as decision problems with input restrictions. Formally [26], a promise problem is a pair (𝒫,𝒞) of decidable sets. A solution to (𝒫,𝒞) is a decidable set 𝒮 such that 𝒮𝒫=𝒞𝒫. We say that the promise problem (𝒫,𝒞) is polynomial-time solvable if it has a solution in P, and if every solution is NP-hard, we say that (𝒫,𝒞) is NP-hard.

Given a pair of (possibly infinite) structures 𝔸 and 𝔹 (with the same finite signature) whose CSPs are decidable, the restricted CSP RCSP(𝔸,𝔹) is the promise problem (CSP(𝔹),CSP(𝔸)). In this case, we call (𝔸,𝔹) the template of the restricted CSP, 𝔸 is called the domain and 𝔹 the restriction. In particular, if 𝔸 is finite we say that RCSP(𝔸,𝔹) is a finite domain RCSP, and if 𝔹 is finite, we say that RCSP(𝔸,𝔹) is an RCSP with finite restriction.

Informally, the promise problem RCSP(𝔸,𝔹) is CSP(𝔸) where the input is promised to belong to CSP(𝔹). For instance, RCSP(𝕂3,𝕂4) is essentially the problem of deciding whether an input 4-colourable graph is 3-colourable.

Notice that for any digraph (structure) 𝔸 the problems CSP(𝔸) and RCSP(𝔸,𝕃) are the same problems where 𝕃 is the loop. So every decidable CSP is captured by an RCSP with finite restriction. One of the main results of this work shows that every RCSP with finite restriction is log-space equivalent to a CSP. It follows from the proof that every finite domain RCSP with finite restriction is log-space equivalent to a finite domain CSP, and thus, finite domain restricted CSPs with finite restrictions have a P versus NP-hard dichotomy. Moreover, the reduction mentioned in this paragraph are obtained by restricted primitive positive construction (rpp-constructions), which are the natural cousins of pp-constructions for CSPs [5] and for PCSPs [3].

3.1 Restricted primitive positive constructions

Several reductions in graph algorithmics arise from gadget reductions. For instance, a standard way of proving that CSP(5) is NP-complete can be done with the following gadget reduction from CSP(𝕂5). On input 𝔾 to CSP(𝕂5), consider the graph obtained from 𝔾 by replacing every edge e:=(x,y) by a path x,ue,ve,y (see, e.g., [21] where this is called an indicator construction). So in this case, the path on four vertices is the gadget associated to this reduction). The algebraic approach to CSPs proposes a general framework encompassing gadget reductions between constraint satisfaction problems. In this section we introduce primitive positive constructions, and restricted primitive positive constructions.

Primitive positive constructions

Given a pair of finite relational signature τ and σ, a primitive positive definition (of τ in σ)222When the signatures are clear from context we will simply say talk about a primitive positive definition. of dimension d+ is a finite set Δ of primitive positive formulas δR(x¯) indexed by σ, and for each Rσ of arity r the formula δR(x¯) has rd free variables.

For every primitive positive definition of σ in τ we associate a mapping ΠΔ from τ-structures to σ-structures as follows. Given a τ-structure 𝔸 the pp power ΠΔ(𝔸) of 𝔸 is the structure

  • with domain Ad, and

  • for each Rσ of arity r the interpretation of R in ΠΔ(𝔸) consists of the tuples (a¯1,,a¯r)(Ad)r such that 𝔸δR(a¯1,,a¯r).

We say that a structure 𝔸 pp-constructs a structure 𝔹 is there is a primitive positive definition Δ such that ΠΔ(𝔸)𝔹ΠΔ(𝔸), i.e., ΠΔ(𝔸) is homomorphically equivalent to 𝔹. For instance, if Δ is the 1-dimensional primitive positive definition consisting of

δE(x,y):=z1,z2.E(x,z1)E(z1,z2)E(z2,y),

then the pp power ΠΔ(5) of the 5-cycle is the complete graph 𝕂5 (see Figure 2).

 Remark 8.

For every fixed primitive positive definition Δ, the pp-power ΠΔ is a monotone construction with respect to the homomorphism order, i.e., if 𝔸𝔹, then ΠΔ(𝔸)ΠΔ(𝔹) (because existential positive formulas are preserved by homomorphism [6, Theorem 2.5.2]).

Figure 2: Let Δ be the primitive positive definition (of {E} in {E}) where δE(x,y):=z1,z2.E(x,z1)E(z1,z2)E(z2,y). On the left, we depict 5 and its pp power ΠΔ(5)𝕂5 (an undirected edge from x to y represents (x,y) and (y,x)), and on the right, we depict 𝕂2 and its gadget replacement ΓΔ(𝕂2)6 (dashed edges and solid edges indicate the respective edge replacements).

Gadget replacements

For every primitive positive formula δ(x¯) without equalities333If a primitive positive formula contains a conjunct x=y, we obtain an equivalent formula δ by deleting the conjunct x=y and replacing each occurrence of the variable y by the variable x. we construct a structure 𝔻δ(d¯) with a distinguished tuples of vertices d as follows.

  • The domain D of 𝔻δ(d¯) consists of a vertex vy for every (free or bounded) variable y of δ.

  • The distinguished vertices d1,,dm are the vertices vx1,,vxm.

  • For every relation symbol R there is a tuple v¯R𝔻δ(d¯) if and only if δ contains the conjunct R(y¯) where v¯ is the tuple of vertices corresponding to the tuple of variables y¯.

The structure 𝔻δ(d¯) is sometimes called the canonical database of δ. For instance, if δE is the formula considered above, the the canonical database of δE is the directed with vertices 1,2,3,4, and the distinguished vertices are 1 and 4.

The canonical database 𝔻δ(d¯) and the primitive positive formula δ are closely related: for every structure 𝔸 and a tuple a¯ of elements of A

𝔸δ(a¯) if and only if there is a homomorphism f:𝔻δ(d¯)𝔸 such that f(d¯)=f(a¯)

(see, e.g., [6, Proposition 1.2.5]).

Building on canonical databases, for every d-dimensional primitive positive definition Δ of σ in τ we associate a mapping ΓΔ from σ-structures to τ-structures as follows. Given a σ-structure 𝔹 the gadget replacement Γϕ(𝔹) is the τ-structure obtained from 𝔹 where

  • for each vertex bB we introduce d vertices b1,,bd, and

  • for each Rσ of arity r, and every tuple (b1,,br)R𝔹 we introduce a fresh copy of 𝔻δR(d¯1,,d¯r) and we identify each d-tuple d¯i with (b1i,,bdi).

Going back to our on going example Δ:={δE} and taking 𝔹:=𝕂2, the gadget replacement ΓΔ(𝔹) is isomorphic to the directed 6-cycle 6 (see Figure 2 for a depiction).

It is straightforward to observe that, in general, for every primitive positive definition Δ, the gadget replacement ΓΔ(𝔹) can be constructed in logarithmic space from 𝔹. Also, these mapping behave like adjoints (see, e.g., Observation 4.4 in [23]).

Log-space reductions and rpp-constructions

We say that a (not necessarily finite) restricted CSP template (𝔸,𝔹) rpp-constructs a restricted CSP template (𝔸,𝔹) if there is a primitive positive definition Δ such that

(ΠΔ(𝔸)×𝔹)(𝔸×𝔹) and 𝔹ΠΔ(𝔹).
 Remark 9.

Every primitive positive formula is satisfiable in some finite structure, e.g., in the loop 𝕃. This implies that for every primitive positive definition of σ in τ the pp-power ΠΔ(𝕃τ) of the (τ-)loop is homomorphically equivalent to the (σ-)loop 𝕃σ. In particular, this implies that the following statements are equivalent for every τ-structure 𝔸 and every σ-structure 𝔸.

  • 𝔸 pp-constructs 𝔸.

  • (𝔸,𝕃τ) rpp-constructs (𝔸,𝕃σ).

  • (𝔸,𝕃τ) rpp-constructs (𝔸,𝔹) for ever structure 𝔹.

As mentioned above, pp-constructions compose, and building on this fact, it is straightforward to observe that rpp-constructions compose (see also [19, Lemma 13]).

Lemma 10.

Consider three restricted CSP templates (𝔸1,𝔹1), (𝔸2,𝔹2), and (𝔸3,𝔹3). If (𝔸1,𝔹1) rpp-constructs (𝔸2,𝔸2), and (𝔸2,𝔹2) rpp-constructs (𝔸3,𝔹3), then (𝔸1,𝔹1) rpp-constructs (𝔸3,𝔹3).

Also, rpp-constructions yield log-space reductions between RCSPs as pp-constructions do for CSPs (the reader can find a proof in [19, Lemma 14]).

Lemma 11.

Consider two (not necessarily finite) restricted CSP templates (𝔸,𝔹) and (𝔸,𝔹). If (𝔸,𝔹) rpp-constructs (𝔸,𝔹), then there is a log-space reduction from RCSP(𝔸,𝔹) to RCSP(𝔸,𝔹).

Example 12.

Observe that the restricted CSP template (5,𝕂3) rpp-constructs the template (𝕂5,𝕃) via the formula

δE(x,y):=z1,z2.E(x,z1)E(z1,z2)E(z2,y).

Indeed, we already noticed that the pp power ΠΔ(5) is isomorphic to 𝕂5. It is also not hard to observe that the pp power ΠΔ(𝕂5) is homomorphically equivalent to the loop 𝕃. Hence, by Lemma 11 we conclude that RCSP(5,𝕂3) is NP-hard, i.e., deciding if a 3-colourable graph 𝔾 admits a homomorphism to 5 is NP-hard.

4 Finite domain restrictions

In this section we show that for every restricted CSP template (𝔸,𝔹) with finite restriction, there is a structure such that RCSP(𝔸,𝔹) and CSP() are log-space equivalent. Moreover, if 𝔸 is also a finite structure, then is a finite structure. It thus follows from the finite domain dichotomy [11, 27] that restricted CSPs with finite domain and finite restriction, have a P versus NP-complete dichotomy.

4.1 Exponential structures

Given a pair of τ-structures 𝔸 and 𝔹 the exponential 𝔸𝔹 is the τ-structure

  • with vertex set all functions f:BA, and

  • for each Rτ of arity r there is an r-tuple (f1,,fr) belongs to the interpretation of R in 𝔸𝔹 if and only if (f1(b1),,fr(br))R𝔸 whenever (b1,,br)R𝔹.

In Figure 3 we depict an exponential digraph construction. This image is also found in [21], where the reader can also find further discussion and properties; we list two of them (see also [15, Corollary 1.5.12]).

Lemma 13.

The following statements hold for all τ-structures 𝔸,𝔹 and .

  • 𝔸𝕃 is isomorphic to 𝔸.

  • 𝔸𝔹 if and only if ×𝔹𝔸.

Corollary 14.

For every pair of (possibly infinite) τ-structures 𝔸 and 𝔹, the restricted CSP template (𝔸𝔹,𝕃) rpp-constructs the template (𝔸,𝔹).

Proof.

Let Δ be the trivial primitive positive definition of τ in τ, i.e., for each Rτ or arity r let δR(x1,,xr):=R(x1,,xr). So for every structure 𝔸 the equality ΠΔ(𝔸)=𝔸 holds. Clearly, 𝔹𝕃=ΠΔ(𝕃), and notice that 𝔸𝔹×𝔹 is homomorphically equivalent to 𝔸×𝔹: since 𝔸𝔹𝔸𝔹, it follows from the second item in Lemma 13 that 𝔸𝔹×𝔹𝔸, and clearly 𝔸𝔹×𝔹𝔹, so 𝔸𝔹×𝔹𝔸×𝔹; conversely, (𝔸×𝔹)×𝔹𝔸, so by Lemma 13, 𝔸×𝔹𝔸𝔹, and since 𝔸×𝔹𝔹, it follows that 𝔸×𝔹𝔸𝔹×𝔹. Therefore, Δ is a primitive positive definition witnessing that the claim of the lemma holds.

Figure 3: The exponential 3𝕂2 where a label ij represents the function f:{1,2}{1,2,3} defined by 1i and 2j.
Lemma 15.

Let τ be a finite relational signature, and 𝔸 be a (possible infinite) τ-structure. If 𝔹 is a finite τ-structure, then the restricted RCSP template (𝔸,𝔹) rpp-constructs the RCSP template (𝔸𝔹,𝕃).

Proof.

We first show that (𝔸,𝔹) rpp-constructs (𝔸𝔹,𝕃), and we consider the case of digraphs but it naturally generalizes to τ-structures for finite τ. Let B={b1,,bm} and consider the following m-dimensional primitive positive definition Δ:={δE}, where

δE(x1,,xm,y1,,ym):=(bi,bj)E𝔹E(xi,yj).

Notice that for any structure 𝔸 the pp-power ΠΔ is isomorphic to 𝔸𝔹. Indeed, identify a tuple (a1,,am) of A with the function defined by biai, it now follows from the definition of the exponential structure and of δE that this mapping is an isomorphism. In particular, notice that ΠΔ(𝔹)=𝔹𝔹 contains the loop 𝕃 (the identity function I:BB is a loop on 𝔹𝔹). Hence,

ΠΔ(𝔸)𝔸𝔹 and 𝕃ΠΔ(𝔹),

i.e., Δ is a witness to the fact that (𝔸,𝔹) rpp-constructs (𝔸𝔹,𝕃).

We discuss two applications of this lemma. The first one being that rpp-constructions between RCSP templates with finite restrictions are captured by (standard) pp-constructions.

Theorem 16.

The following statements are equivalent for every pair of restricted CSP templates (𝔸1,𝔹1) and (𝔸2,𝔹2) with finite restrictions.

  • (𝔸1,𝔹1) rpp-constructs (𝔸2,𝔹2) and,

  • 𝔸1𝔹1 pp-constructs 𝔸2𝔹2.

In particular, (𝔸1,𝔹1) and (𝔸1𝔹1,𝕃) are mutually rpp-constructible (and so RCSP(𝔸1,𝔹1) and CSP(𝔸1𝔹2) are log-space Turing-equivalent).

Proof.

Suppose that 𝔸1𝔹1 pp-constructs 𝔸2𝔹2, so by Remark 9 the template (𝔸1𝔹1,𝕃) rpp-constructs (𝔸2𝔹2,𝕃). By Lemma 15, (𝔸1,𝔹1) rpp-constructs (𝔸1𝔹1,𝕃), and by Corollary 14 (𝔸2𝔹2,𝕃) rpp-constructs (𝔸2,𝔹2). Hence, by composing rpp-constructions (Lemma 10), we conclude that (𝔸1,𝔹1) rpp-constructs (𝔸2,𝔹2). The converse implication follows with similar arguments: (𝔸2,𝔹2) rpp-constructs (𝔸2𝔹2,𝕃) (Lemma 15), and (𝔸1𝔹1,𝕃) rpp-constructs (𝔸1,𝔹1) (Corollary 14); by composing rpp-constructions we see that (𝔸1𝔹1,𝕃) rpp-constructs (𝔸2𝔹2,𝕃), and it thus follows that 𝔸1𝔹1 pp-constructs 𝔸2𝔹2 (Remark 9).

The second application of Lemma 15 is the following statement which is analogous to the case of CSPs and pp-constructions (see, e.g., [6, Theorem 3.2.2]).

Corollary 17.

The following statements are equivalent for every (possibly infinite) structure 𝔸 and a finite structure 𝔹 with a finite signature.

  • The restricted CSP template (𝔸,𝔹) rpp-constructs (𝕂3,𝕃).

  • The restricted CSP template (𝔸,𝔹) rpp-constructs every restricted CSP template (𝔸,𝔹) where 𝔸 is a finite structure (and 𝔹 a possibly infinite structure).

  • The structure 𝔸𝔹 pp-constructs 𝕂3.

If any of these equivalent statements hold, then RCSP(𝔸,𝔹) is NP-hard.

Proof.

By the first item of Lemma 13 we know that 𝕂3𝕃 is isomorphic to 𝕂3, and so 𝔸𝔹 pp-constructs 𝕂3 if and only if 𝔸𝔹 pp-constructs 𝕂3𝕃. Hence, the equivalence between the first and third itemized statement follows from Theorem 16. Also, the second statement clearly implies the third one. Finally, we show that the first item implies the second one. It is well-known that that 𝕂3 pp-constructs every finite structure 𝔸 (see, e.g., [6, Corollary 3.2.1]). So, by Remark 9 (𝕂3,𝕃) rpp-constructs every finite domain RCSP template (𝔸,𝔹) (where 𝔹 is a possibly infinite structure). Again, by composing rpp-constructions, we conclude that (𝔸,𝔹) rpp-constructs (𝔸,𝔹). The equivalence between the three itemized statement is now settled. The final statement holds because pp-construction yield log-space reduction (see, e.g., Corollary 3.5 in [5]), and because RCSP(𝕂3,𝕃)=CSP(𝕂3) is NP-hard.

4.2 A dichotomy for finite domain RCSPs

The dichotomy for finite domain CSPs asserts that if 𝔸 is a finite structure, then either 𝔸 pp-constructs 𝕂3, and in this case CSP(𝔸) is NP-complete; or otherwise, CSP(𝔸) is polynomial-time solvable. We apply the results of this section to obtain an analogous (actually, equivalent) statement for finite domain CSPs with finite restrictions.

Theorem 18.

For every pair of finite structures 𝔸,𝔹 one of the following statements hold.

  • Either (𝔸,𝔹) rpp-constructs (𝕂3,𝕃) (and consequently, RCSP(𝔸,𝔹) is NP-hard), or

  • RCSP(𝔸,𝔹) is polynomial-time solvable.

Proof.

Suppose that the first itemized statement does not hold, and assume PNP (otherwise, CSP(𝔸) is in P, and thus RCSP(𝔸,𝔹) is polynomial-time solvable). Since (𝔸,𝔹) does not rpp-construct (𝕂3,𝕃), it follows from Corollary 17 that 𝔸𝔹 does not pp-construct 𝕂3. Hence, the finite domain dichotomy implies that CSP(𝔸𝔹) is in P. By the “in particular” statement of Theorem 16 we know that CSP(𝔸𝔹) and RCSP(𝔸,𝔹) are polynomial-time equivalent, and we thus conclude that RCSP(𝔸,𝔹) is polynomial-time solvable.

RCSPs also make sense in the infinite setting, but this diverges from the main axis of this paper. Regarding finite domain RCSPs with infinite restrictions, the dichotomy from Theorem 18 can be leveraged into a dichotomy for finite-domain with certain tame infinite restrictions [19, Theorem 23]. Regarding infinite domain RCSPs we have little hope since infinite domain CSPs remain far from being understood. However, the tractability conjecture is a generalization of the Feder-Vardi conjecture to a broad class of “well-behaved” infinite structures. In the full version of this paper, we see that the tractability conjecture has an equivalent statement in terms of RCSPs of “well-behaved” infinite structures with finite restrictions [19, Theorem 24].

4.3 A small remark regarding PCSPs

Theorem 16 asserts in particular that RCSP(𝔸,𝔹) is log-space equivalent to CSP(𝔸𝔹). The following statement strengthens this connection by showing that these two problems are further log-space equivalent to PCSP(𝔸,𝔸𝔹) – the proofs are quite straightforward, and we leave them for the full version [19, Section 4.6].

Lemma 19.

For every possibly infinite structure 𝔸 and a (possibly infinite) structure and 𝔹 a finite structure, the following problems are polynomial-time equivalent.

  • the constraint satisfaction problem CSP(𝔸𝔹),

  • the promise constraint satisfaction problem PCSP(𝔸,𝔸𝔹), and

  • the restricted constraint satisfaction problem RCSP(𝔸,𝔹).

Corollary 20.

For every non-bipartite graph and every finite digraph 𝔻 one of the following holds.

  • Either 𝔻, and in this case PCSP(,𝔻) is polynomial-time solvable,

  • or 𝔻↛, and in this case PCSP(,𝔻) is NP-hard.

5 Homomorphism-free restrictions

As mentioned above, the reader familiar with monotone monadic strict NP (MMSNP) can notice that digraph (finite domain) CSPs with input restriction to -homomorphism-free digraphs (structures) can be solved by infinite domain CSPs expressible in MMSNP. Thus, these problems exhibit a P versus NP-complete dichotomy (see, e.g., [7, 14]). Feder and Vardi reduce problems in MMSNP to finite domain CSPs. Their reduction changes the input signature, and then uses the Sparse Incomparability Lemma. Here, we prove the following lemma which allows us to preserve the signature by using duality pairs, and then, as Feder and Vardi, we proceed via Sparse Incomparability (see Section 5 in [19]).

Lemma 21.

For every finite set of structures and every finite digraph (structure) 𝔹, there is a finite set of structures 𝒞 such that the following problems are polynomial-time equivalent:

  • deciding if an input structure 𝔸 belongs to CSP() for some 𝒞, and

  • CSP(𝔹) restricted to -homomorphism-free structures.

The next theorem now follows directly from Lemma 21 and the finite domain CSP dichotomy [28].

Theorem 22.

For every finite digraph (structure) and every finite set of digraphs (structures) , CSP() restricted to -homomorphism-free digraphs (structures) is either in P or NP-complete.

6 Acyclic digraphs and bounded paths

In this section we apply our results above, and the theory of constraint satisfaction to obtain results in the context of -(subgraph)-free algorithmics. The main result of this section settles Question 3 (Theorem 25).

Consider a finite digraph , and let k be a positive integer. For a given function f:(H×[k])n(H×[k]) and for each i[k] we define a function

fi:HnH by (h1,,hn)πH(f((h1,i),,(hn,i))),

where πH is the projection of H×[k] onto H.

Lemma 23.

Let be a digraph, k a positive integer, and f:(×𝕋k)n(×𝕋k) and n-ary polymorphism of ×𝕋k. If there are i,j[k] with i<j such that fi=fj, then fi is an n-ary polymorphism of , and if f satisfies the equalities

f(xσ(1),,xσ(n))=f(xρ(1),,xρ(n)) for all x1,,xmH×[k]

for some σ,ρ:[n][m], then fi satisfies the equalities

fi(hσ(1),,hσ(n))=fi(hρ(1),,hρ(n)) for all h1,,hnH.
Proof.

We first see that fi is an n-ary polymorphism of . Let ((h1,,hn),(h1,,hn)) be an edge of n, i.e., (hm,hm) is an edge for for each m[n]. Since i<j, it follows that ((h1,i),,(hn,i)),((h1,j),,(hn,j)) is an edge of ×𝕋n. Since f is a polymorphism, it must be the case that (f((h1,i),,(hn,i)),f((h1,j),,(hn,j))) is an edge of ×𝕋n. Recall that the projection πH is a homomorphism from ×𝕋n onto , and so

(fi(h1,,hn),fj(h1,,hn))=(πHf((h1,i),,(hn,i)),πHf((h1,j),,(hn,j)))E().

Finally, since fi=fj, it follows that (fi(h1,,hn),fj(h1,,hn)) is an edge of , and thus fi:n is an n-ary polymorphism of .

Now, let h1,,hmH, and for each l[n] let h¯l:=(hl,i), so

fi(hσ(1),,hσ(n))=πH(f(h¯σ(1),,h¯σ(n)).

Since f satisfies the loop condition for σ and ρ, it follows that

πH(f(h¯σ(1),,h¯σ(n))=πH(f(h¯ρ(1),,h¯ρ(n))=fi(hρ(1),,hρ(n)).

And thus, fi(hσ(1),,hσ(n))=fi(hρ(1),,hρ(n)), and since the choice of h1,,hmH was arbitrary, the claim of this lemma follows.

Theorem 24.

For every finite digraph one of the following statements holds.

  • Either has a polymorphism satisfying the Sigger’s identity, and RCSP(,𝕋k) is in P for every positive integer k, or

  • otherwise, RCSP(,𝕋k) is NP-hard for every large enough k.

Proof.

The first item holds by Theorem 4, and because if CSP() is in P, then RCSP(,𝕋k) is in P for every positive integer k. Now, suppose that does not have a polymorphism satisfying the Sigger’s identity. Since CSP(𝕋k) can be verified in polynomial-time (see, e.g., Observation 6), it follows that RCSP(,𝕋k) and CSP(×𝕋k) are polynomial-time equivalent. Let M=|H|4|H|+1, and consider a polymorphism f:(×𝕋M)4. Clearly, there are M1 functions from H4 to H, and since for each i[M] every fi is a 4-ary function of H, it follows from the choice of M that there are i<jM such that fi=fj. So, by Lemma 23 if f satisfies the Sigger’s identity, then fi satisfies the Sigger’s identity. Since does not have such a polymorphism, then ×𝕋M does not have such a polymorphism, and hence CSP(×𝕋k) is NP-hard (see, e.g., Theorem 4). Moreover, since CSP(×𝕋M) is polynomial-time equivalent to RCSP(,𝕋M), it follows that RCSP(,𝕋M) is NP-hard. Finally, it is straightforward to observe that if RCSP(,𝕋n) is at least as hard as RCSP(,𝕋n+1), and so, if N is the smallest integer such that ×𝕋N does not have a Sigger’s polymorphism, then N witnesses that the second itemized statement holds.

As promised, we apply the framework of RCSPs to the context of -(subgraph)-free algorithmics – recall that the class of k-subgraph-free acyclic digraphs equals the class of k-homomorphism-free digraphs.

Theorem 25.

For every digraph such that CSP() is NP-hard, there is a positive integer N|H|4|H|+1 such that CSP() remains NP-complete even for N-subgraph-free acyclic digraphs. Moreover, there is such an N such that CSP() is polynomial-time solvable when the input is a N1-subgraph-free acyclic digraphs.

Proof.

If P=NP the claim is trivial, so we assume that PNP. Notice that a digraph 𝔻 is acyclic and has no directed path on N vertices if and only if there is no homomorphism N𝔻. Also, since CSP() is NP-complete and we are assuming that PNP, it follows from Theorem 4 that has no Siggers polymorphism. The claim of this theorem now follows from these simple arguments and Theorem 24.

Corollary 26.

Let be a digraph such that CSP() is NP-hard. Then, there are positive integers N and M such that

  • CSP() is NP-hard for k-free digraphs whenever kN, and

  • CSP() is NP-hard for k-subgraph-free digraphs whenever kM.

The following example shows this corollary fails in the infinite (ω-categorical) setting. A structure 𝔹 is ω-categorical if for every positive integer k the automorphism group of 𝔹 defines finitely many orbits of k-tuples.

Example 27.

Let be the disjoint union of 𝕂3 and the rational numbers with the strict linear order. It is straightforward to observe that 3-Colouring reduces to CSP(), and that every acyclic digraph 𝔻 is a yes-instance of CSP(). Hence, CSP() is NP-complete, but it is polynomial-time solvable on acyclic instances. The fact that is ω-categorical follows from its definition – it is the disjoin union of two ω-categorical digraphs.

7 Digraphs on three vertices

In this section we answer Question 1 for digraphs on three vertices. A loopless digraph on three vertices either contains two directed cycles and its CSP is NP-complete, or otherwise its CSP is polynomial-time solvable. Hence, we focus on the three loopless digraphs on three vertices: 3+ (obtained from the directed cycle by adding one edge), 3++ (obtained from the directed cycle by adding two edges), and 𝕂3 – see also Figure 4.

Figure 4: The three digraphs on three vertices whose CSP is NP-complete.

Also note that these three digraphs are hereditarily hard (see, e.g., Conjecture 2.5 in [2] proved in [4]), and it thus follows from Theorem 5 that RCSP(,𝕋4) is NP-hard for {3+,3++,𝕂3}. In turn, this implies that for such digraphs the problem CSP() is NP-hard even restricted to 5-(subgraph)-free digraphs.

 Remark 28.

If a 4-subgraph-free weakly connected digraph 𝔻 contains (as a subgraph) a directed 3-cycle v1,v2,v3, then D={v1,v2,v3}. Indeed, since 𝔻 is 4-subgraph-free and (v1,v2),(v2,v3),(v3,v1)E, it must be the case that the out- and in-neighbourhood of each vi is a subset of {v1,v2,v3} (and so, the claim follows because 𝔻 is weakly connected).

We now show that CSP(3+) is tractable when the input is restricted to 4-subgraph-free digraphs. To do so, we reduce this problem to the list version of CSP(𝔾) where 𝔾 is the digraph depicted in Figure 5, and we briefly argue that this problem is polynomial-time solvable.

Lemma 29.

The digraph 𝔾 from Figure 5 has a conservative majority polymorphism. In particular, CSP(𝔾,U) can be solved in polynomial time.

Proof.

We define a conservative majority function f:G3G, and we then argue that it is a polymorphism. We denote by π1 the projection onto the first coordinate, and by maj(x,y,z) the majority operation when |{x,y,z}|2. Also, we simplify our writing by implicitly assuming that in the n-th itemized case of the following definition, neither of the first n1 cases holds.

f(x,y,z)={maj(x,y,z)if |{x,y,z}|2,1if 1{x,y,z}, and {3,7}{x,y,z},2if 2{x,y,z}, and {6,7}{x,y,z},3if 3{x,y,z}, and {5,7}{x,y,z},4if 4,6{x,y,z},6if {x,y,z}={5,6,7},π1(x,y,z)otherwise.

It is clear that f is a symmetric conservative majority function. It is routine verifying that f is indeed a polymorphism. The fact that CSP(𝔾,U) can be solved in polynomial time now follows from [12] because the same function f defines a majority polymorphism of (𝔾,U).

Lemma 30.

CSP(3+) can be solved in polynomial-time when the input is restricted to 4-subgraph-free digraphs.

Proof.

Consider a loopless weakly connected digraph 𝔻 with no directed 3-cycles. Let B be the subset of vertices of 𝔻 incident to some symmetric edge, and let 𝔻 be the digraph obtained from 𝔻 after removing exactly one edge from each symmetric pair of edges. It is straightforward to observe there is no homomorphism from the directed path on four vertices to 𝔻. Hence, by Observation 6, (𝔻,B) homomorphically maps to (𝕋3,{1,2,3}) considered as a {E,U}-structure where E is a binary predicate and U a unary predicate (this simply means that there is a homomorphism 𝔻𝕋3 such that every vertex in B is mapped to a vertex in {1,2,3}). Also note that 𝔻3+ if and only if there is a homomorphism f:𝔻3+ where f(B){2,3}, i.e., 𝔻3+ if and only if (𝔻,B)(3+,{2,3}) (as {E,U}-structures). It follows from these arguments that CSP(3+) restricted to {3,4}-subgraph-free digraphs reduces in polynomial time to CSP((3+,{2,3})×(𝕋3,{1,2,3})). It is not hard to observe that the core of (3+,{2,3})×(𝕋3,{1,2,3}) is the structure (𝔾,U) depicted in Figure 5, whose CSP can be solved in polynomial time (Lemma 29).

Figure 5: A {E,U}-structure where E is a binary relation represented by arcs, and U is a unary relation represented by black vertices.

An algorithm that solves CSP(3+) in polynomial time when the input is restricted to 4-subgraph-free digraphs processes each weakly connected component of the input 𝔻 and accepts if and only if the following subroutine accepts each weakly connected component. On a weakly connected component 𝔻 of 𝔻, the subroutine distinguishes whether 𝔻 is 3-subgraph-free: if not, it accepts if 𝔻 is either 3 or 3+, and rejects otherwise – this step is consistent and correct because |D|=3 (see Remark 28); if 𝔻 is 3-free, then the subroutine accepts or rejects 𝔻 according to the reduction to CSP(𝔾,U) explained above. Given the arguments in the previous paragraph, it is clear that this algorithm is consistent, correct, and runs in polynomial time.

Theorem 31.

The following statements hold for every positive integer k.

  • If k4, then CSP(3+), CSP(3++), and CSP(𝕂3) are solvable in polynomial-time when the input is restricted to k-subgraph-free digraphs.

  • If k5, then CSP(3+), CSP(3++), and CSP(𝕂3) are NP-hard even if the input is restricted to k-subgraph-free digraphs.

Proof.

The second item follows from the arguments above. The first item holds for 𝕂3 because every loopless 4-subgraph-free digraph is 3-colourable [19, Observation 38]. Similarly, every loopless {𝕂3,4}-subgraph-free digraph 𝔻 admits a homomorphism to 3++ [19, Lemma 39]. Hence, the first itemized statement holds for 3++. Finally, the tractability of CSP(3+) restricted to 4-subgraph-free digraphs follows by Lemma 30.

Contrary to the k-subgraph-free case, the CSPs of CSP(3+), CSP(3++), and CSP(𝕂3) have different behaviours with respect to k-free input restrictions. Due to space restrictions, we limit ourselves to present a proof idea, and refer the reader to Section 7.2 in the full version for a complete proof.

Theorem 32.

The following statements hold for every positive integer k2.

  • CSP(3+) is solvable in quadratic time for k-free digraphs if k3, and NP-hard even for k-free digraphs if k4,

  • CSP(3++) is solvable in linear time for k-free digraphs if k=2, and NP-hard even for k-free digraphs if k3, and

  • CSP(𝕂3) is NP-hard even for k-free digraphs.

Proof idea.

The case of 𝕂3 is straightforward since CSP(𝕂3) is NP-complete for symmetric digraphs. The hard cases from the first and second item follow with standard gadget reductions; see [19, Lemma 43] for the former, and [19, Lemma 45] for the latter. Now, notice that CSP(3++) restricted to 2-free digraphs reduces to CSP(𝕂2). Indeed, a symmetric digraph 𝔻 maps to 3++ if and only if 𝔻 is bipartite. Finally, the tractability of CSP(3+) restricted to 3-free digraphs is proved in [19, Lemma 44], where on a given 3-free digraph 𝔻, the idea of the algorithm is the following. At each step there are three sets X1,X2,X3D such that the mapping xi if xXi defines a partial homomorphism from 𝔻 to 3+. We extend these sets to X1,X2,X3 in such a way that the partial homomorphism defined by X1,X2,X3 extends to a homomorphism from 𝔻3+ if and only if the partial homomorphism defined by X1,X2,X3 extends to a homomorphism from 𝔻3+.

8 A family of smooth tournaments

In this section we answer Question 1 for a natural family of smooth tournaments 𝕋n. Given a positive integer n, we denote by 𝕋n the tournament obtained from 𝕋n be reversing the edge from the source to the sink (see Figure 6). In particular, 𝕋2𝕋2, and 𝕋33, so CSP(𝕋n) is polynomial-time solvable for n3, and NP-complete for n4 (see, e.g., [1]).

Figure 6: A depiction of the 𝕋n – for a cleaner picture we omit the edges (1,n2),(1,n1),(2,n), and (3,n).

Since 𝕋n is a hereditarily hard digraph ([2, Conjecture 2.5] proved in [4]) and 𝕋n↛𝕋n, it follows that RCSP(𝕋n,𝕋n) is NP-hard (Theorem 5). Equivalently, CSP(𝕋n) is NP-hard for digraphs with no directed walk on n+1 vertices, and since 𝕋n1𝕋n, CSP(𝕋n) is polynomial-time solvable for digraphs with no directed walk on n vertices. However, if we only forbid k as a subgraph (and not homomorphically), it turns out that CSP(𝕋n) is NP-hard even for 5-subgraph-free digraphs. This hardness proof uses a similar gadget reduction as in the case of CSP(3+) [19, Lemma 47].

Theorem 33.

For every pair of positive integers n and k the following statements hold.

  • If n3 or k4, then CSP(𝕋n) is in P for k-subgraph-free digraphs.

  • If n4 and k5, then CSP(𝕋n) is NP-hard even for k-subgraph-free digraphs.

Proof.

The hard cases follow from  [19, Lemma 47]. The polynomial-time cases when n3 follow because 𝕋n𝕋n when n3. For, n4, the polynomial-time cases follow by Lemma 48 in [19] that CSP(𝕋n) is in P for 4-subgraph-free digraphs because 𝕋n is an oriented graph and contains 𝕋3.

The idea of deterministically extending a partial homomorphism to solve CSP(3+) on 3-free instances can also be used to see that CSP(𝕋n) is polynomial-time solvable on 3-free instances. Moreover, in this case it also follows that there are finitely many minimal 3-free obstruction to CSP(𝕋n), and with a little extra work, we can even spell out these minimal obstructions. To streamline this paper, we present these lists in the full version of this paper [19, Section 8.2]. For now, we answer Question 1.2 for 𝕋n, where the hard cases are proved in Lemma 47 from [19], and the tractable ones are an immediate consequence of Theorem 55 in [19].

Theorem 34.

For every positive integer k and n4 one of the following holds

  • k3 and in this case CSP(𝕋n) is tractable where the input is restricted to k-free digraphs, or

  • k4 and in this case CSP(𝕋n) is NP-complete where the input is restricted to k-free digraphs.

9 Omitting a single digraph

As mentioned in the introduction, the long-term question of the research line introduced in this paper is the following.

Question 35.

Is there a P versus NP-complete dichotomy of CSP() where the input is restricted

  1. 1.

    to 𝔽-free digraphs?

  2. 2.

    to 𝔽-subgraph-free digraphs?

Having settled Question 1 for the digraphs on three vertices and for the family of tournaments 𝕋n, a natural next step is tackling Question 35 for these digraphs. In [19, Section 9], we discuss several results in this direction which follow from our previous work. We present the current landscape in Tables 1 and 2 in [19]. Here, we merge the main results of Section 9 in [19] (Theorem 57 and Corollary 60) in the following statement.

Theorem 36.

For every positive integer n the problems CSP(3+) and CSP(𝕋n) are NP-hard even when the input is restricted to 𝔽-subgraph-free digraphs, whenever 𝔽 is not a disjoint union of oriented paths, or when 𝔽 is a connected digraph with |F|12.

10 Conclusion and outlook

In this paper we have brought together homomorphisms, digraphs and -(subgraph-)free algorithmics. In doing so, we have uncovered a series of results concerning not only restricted CSPs, but also hardness of digraph CSPs under natural restrictions such as acyclicity. Our work raises numerous open problems, which we believe deserve attention in the future. Besides Questions 1 and 35, we ask the following.

  • Is it true that for every finite structure 𝔸 and every (possibly infinite) 𝔹, if (𝔸,𝔹) does not rpp-construct (𝕂3,𝕃), then RCSP(𝔸,𝔹) is polynomial-time solvable?

  • Do finite-domain RCSPs (with possibly infinite restriction) exhibit a P vs. NP-hard dichotomy? (Assuming PNP)

  • Characterize the class of finite digraphs (structures) 𝔸 such that RCSP(𝔸,𝔹) is NP-hard for every finite 𝔹 such that 𝔹↛𝔸 (assuming PNP).

  • Characterize the class of finite digraphs (structures) 𝔸 that persistently construct 𝕂3, i.e., the template (𝔸,𝔹) rpp-constructs (𝕂3,𝕃) whenever 𝔹↛𝔸. See also [19, Observation 63].

  • Characterize the class of finite digraphs (structures) such that RCSP(,) is NP-hard whenever ↛ (assuming PNP).

  • Since CSP() reduces to CSP() on acyclic instances (Theorem 25), and the latter is equivalent to CSP(×) we ask: is it true that for every finite digraph the (infinite) digraph × pp-constructs ?

  • Is it true that for every tournament there a finitely many 3-free minimal obstructions to CSP()? (Compare to [19, Theorem 55]).

References

  • [1] Jørgen Bang-Jensen, Pavol Hell, and Gary MacGillivray. The complexity of colouring by semicomplete digraphs. SIAM Journal on Discrete Mathematics, 1(3):281–298, 1988. doi:10.1137/0401029.
  • [2] Jorgen Bang-Jensen, Pavol Hell, and Gary MacGillivray. Hereditarily hard H-colouring problems. Discrete Mathematics, 138:75–92, 1995. doi:10.1016/0012-365X(94)00189-P.
  • [3] Libor Barto, Jakub Bulín, Andrei A. Krokhin, and Jakub Opršal. Algebraic approach to promise constraint satisfaction. J. ACM, 68(4):28:1–28:66, 2021. doi:10.1145/3457606.
  • [4] Libor Barto, Marcin Kozik, and Todd Niven. The CSP dichotomy holds for digraphs with no sources and no sinks (a positive answer to a conjecture of Bang-Jensen and Hell). SIAM Journal on Computing, 38(5), 2009. doi:10.1137/070708093.
  • [5] Libor Barto, Jakub Opršal, and Michael Pinsker. The wonderland of reflections. Israel Journal of Mathematics, 223(1):363–398, 2018. doi:10.1007/s11856-017-1621-9.
  • [6] Manuel Bodirsky. Complexity of Infinite-Domain Constraint Satisfaction. Lecture Notes in Logic (52). Cambridge University Press, Cambridge, United Kingdom; New York, NY, 2021. doi:10.1017/9781107337534.
  • [7] Manuel Bodirsky, Florent R. Madelaine, and Antoine Mottet. A proof of the algebraic tractability conjecture for monotone monadic SNP. SIAM J. Comput., 50(4):1359–1409, 2021. doi:10.1137/19M128466X.
  • [8] Flavia Bonomo, Maria Chudnovsky, Peter Maceli, Oliver Schaudt, Maya Stein, and Mingxian Zhong. Three-Coloring and List Three-Coloring of Graphs Without Induced Paths on Seven Vertices. Combinatorica, 38:779–801, 2018. doi:10.1007/s00493-017-3553-8.
  • [9] Richard C. Brewster and Timothy Graves. On the restricted homomorphism problem. Discret. Appl. Math., 156(14):2823–2826, 2008. doi:10.1016/j.dam.2007.03.028.
  • [10] Richard C. Brewster, Pavol Hell, and Gary MacGillivray. The complexity of restricted graph homomorphisms. Discret. Math., 167-168:145–154, 1997. Selected Papers 15th British Combinatorial Conference. doi:10.1016/S0012-365X(96)00223-3.
  • [11] Andrei A. Bulatov. A dichotomy theorem for nonuniform CSPs. In 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, pages 319–330, 2017. doi:10.1109/FOCS.2017.37.
  • [12] Víctor Dalmau and Andrei A. Krokhin. Majority constraints have bounded pathwidth duality. Eur. J. Comb., 29(4):821–837, 2008. doi:10.1016/j.ejc.2007.11.020.
  • [13] P. Erdős. Graph theory and probability. Canadian Journal of Mathematics, 11:34–38, 1959.
  • [14] Tomás Feder and Moshe Y. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: a study through Datalog and group theory. SIAM Journal on Computing, 28:57–104, 1999. doi:10.1137/S0097539794266766.
  • [15] Jan Foniok. Homomorphisms and structural properties of relational systems. Doctoral Thesis, Charles University Prague, Faculty of Mathematics and Physics, 2007.
  • [16] Jan Foniok, Jaroslav Nešetřil, and Claude Tardif. Generalised dualities and maximal finite antichains in the homomorphism order of relational structures. European J. Combin., 29(4):881–899, 2008. doi:10.1016/j.ejc.2007.11.017.
  • [17] Jan Goedgebeur, Jorik Jooken, Karolina Okrasa, Pawel Rzazewski, and Oliver Schaudt. Minimal obstructions to C5-coloring in hereditary graph classes. In Rastislav Královic and Antonín Kucera, editors, 49th International Symposium on Mathematical Foundations of Computer Science, MFCS 2024, August 26-30, 2024, Bratislava, Slovakia, volume 306 of LIPIcs, pages 55:1–55:15, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2024.55.
  • [18] Petr A. Golovach, Matthew Johnson, Daniël Paulusma, and Jian Song. A survey on the computational complexity of coloring graphs with forbidden subgraphs. J. Graph Theory, 84(4):331–363, 2017. doi:10.1002/jgt.22028.
  • [19] Santiago Guzmán-Pro and Barnaby Martin. Restricted CSPs and F-free Digraph Algorithmics. Preprint arXiv:2502.17596, 2025. doi:10.48550/arXiv.2502.17596.
  • [20] Pavol Hell and Aurosish Mishra. H-coloring degree-bounded (acyclic) digraphs. Theor. Comput. Sci., 554:40–49, 2014. doi:10.1016/j.tcs.2014.06.014.
  • [21] Pavol Hell and Jaroslav Nešetřil. On the complexity of H-coloring. Journal of Combinatorial Theory, Series B, 48:92–110, 1990. doi:10.1016/0095-8956(90)90132-J.
  • [22] S. Huang. Improved complexity results on k-coloring. European J. Combin., 51:336–346, 2016. doi:10.1016/j.ejc.2015.06.005.
  • [23] Andrei Krokhin, Jakub Opršal, Marcin Wrochna, and Stanislav Živný. Topology and adjunction in promise constraint satisfaction. SIAM J. Comput., 52(1):38–79, 2023. doi:10.1137/20m1378223.
  • [24] Gábor Kun. Constraints, MMSNP, and expander relational structures. Combinatorica, 33(3):335–347, 2013. doi:10.1007/s00493-013-2405-4.
  • [25] Jaroslav Nesetril and Claude Tardif. Duality theorems for finite structures (characterising gaps and good characterisations). J. Comb. Theory B, 80(1):80–97, 2000. doi:10.1006/jctb.2000.1970.
  • [26] Alan L. Selman. Promise problems complete for complexity classes. Inf. Comput., 78(2):87–97, 1988. doi:10.1016/0890-5401(88)90030-2.
  • [27] Dmitriy Zhuk. A proof of CSP dichotomy conjecture. In Chris Umans, editor, 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, 2017, pages 331–342. IEEE Computer Society, 2017. https://arxiv.org/abs/1704.01914. doi:10.1109/FOCS.2017.38.
  • [28] Dmitriy Zhuk. A proof of the CSP dichotomy conjecture. J. ACM, 67(5):30:1–30:78, 2020. doi:10.1145/3402029.