This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Digraph homomorphism problems and weak near unanimity polymorphisms

Tomás Feder 268 Waverley Street, Palo Alto, CA 94301, United States, [email protected]    Jeff Kinne Indiana State University, IN, USA, [email protected], Supported by NSF grant 1751765    Ashwin Murali Indiana State University, IN, USA, [email protected], supported by NSF 1751765    Arash Rafiey Indiana State University, IN, USA [email protected] and Simon Fraser University, BC, Canada, [email protected], Supported by NSF grant 1751765
Abstract

We consider the problem of finding a homomorphism from an input digraph GG to a fixed digraph HH. We show that if HH admits a weak near unanimity polymorphism ϕ\phi then deciding whether GG admits a homomorphism to HH (HOM(HH)) is polynomial time solvable. This gives a proof of the dichotomy conjecture (now dichotomy theorem) by Feder and Vardi [29]. Our approach is combinatorial, and it is simpler than the two algorithms found by Bulatov [9] and Zhuk [50] in 2017. We have implemented our algorithm and show some experimental results. We use our algorithm together with the recent result [38] for recognition of Maltsev polymorphisms and decide in polynomial time if a given relational structure \mathcal{R} admits a weak near unanimity polymorphism.

1 Introduction

For a digraph GG, let V(G)V(G) denote the vertex set of GG and let A(G)A(G) denote the arcs (aka edges) of GG. An arc (u,v)(u,v) is often written as simply uvuv to shorten expressions. Let |G||G| denote the number of vertices in GG.

A homomorphism of a digraph GG to a digraph HH is a mapping gg of the vertex set of GG to the vertex set of HH so that for every arc uvuv of GG the image g(u)g(v)g(u)g(v) is an arc of HH. A natural decision problem is whether for given digraphs GG and HH there is a homomorphism of GG to HH. If we view (undirected) graphs as digraphs in which each edge is replaced by the two opposite directed arcs, we may apply the definition to graphs as well. An easy reduction from the kk-coloring problem shows that this decision problem is NPNP-hard: a graph GG admits a 33-coloring if and only if there is a homomorphism from GG to K3K_{3}, the complete graph on 33 vertices. As a homomorphism is easily verified if the mapping is given, the homomorphism problem is contained in NPNP and is thus NPNP-complete.

The following version of the problem has attracted much recent attention. For a fixed digraph HH the problem HOM(H)HOM(H) asks if a given input digraph GG admits a homomorphism to HH. Note that while the 33-coloring reduction shows HOM(K3)HOM(K_{3}) is NP-complete, HOM(H)HOM(H) can be easy (in PP) for some graphs HH: for instance if HH contains a vertex with a self-loop, then every graph GG admits a homomorphism to HH. Less trivially, for H=K2H=K_{2} (or more generally, for any bipartite graph HH), there is a homomorphism from GG to K2K_{2} if and only if GG is bipartite. A very natural goal is to identify precisely for which digraphs HH the problem HOM(H)HOM(H) is easy. In the special case of graphs the classification has turned out to be this: if HH contains a vertex with a self-loop or is bipartite, then HOM(H)HOM(H) is in PP, otherwise it is NPNP-complete [31] (see [46] for shorter proofs). This classification result implies a dichotomy of possibilities for the problems HOM(H)HOM(H) when HH is a graph, each problem being NPNP-complete or in PP. However, the dichotomy of HOM(H)HOM(H) remained open for general digraphs HH for a long time. It was observed by Feder and Vardi [29] that this problem is equivalent to the dichotomy of a much larger class of problems in NPNP, in which \mathcal{H} is a fixed finite relational structure. These problems can be viewed as constraint satisfaction problems with a fixed template \mathcal{H} [29], written as CSP(\mathcal{H}).

The CSP(\mathcal{H}) involves deciding, given a set of variables and a set of constraints on the variables, whether or not there is an assignment (form the element of HH) to the variables satisfying all of the constraints.

This problem can be formulated in terms of homomorphims as follows. Given a pair (𝒢,)(\mathcal{G},\mathcal{H}) of relational structures, decide whether or not there is a homomorphism from the first structure to the second structure.

3SAT is a prototypical instance of CSP, where each variable takes values of true or false (a domain size of two) and the clauses are the constraints. Digraph homomorphism problems can also easily be converted into CSPs: the variables VV are the vertices of GG, each must be assigned a vertex in HH (meaning a domain size of |V(H)||V(H)|), and the constraints encode that each arc of GG must be mapped to an arc in HH.

Feder and Vardi argued in [29] that in a well defined sense the class of problems CSP(H)CSP(H) would be the largest subclass of NPNP in which a dichotomy holds. A fundamental result of Ladner [42] asserts that if PNPP\neq NP then there exist NPNP-intermediate problems (problems neither in PP nor NPNP-complete), which implies that there is no such dichotomy theorem for the class of all NPNP problems. Non-trivial and natural sub-classes which do have dichotomy theorems are of great interest. Feder and Vardi made the following Dichotomy Conjecture: every problem CSP(H)CSP(H) is NPNP-complete or is in PP. This problem has animated much research in theoretical computer science. For instance the conjecture has been verified when HH is a conservative relational structure [8], or a digraph with all in-degrees and all-out-degrees at least one [4]. Numerous special cases of this conjecture have been verified [1, 2, 3, 7, 13, 18, 21, 22, 28, 43, 45].

Bulatov gave an algebraic proof for the conjecture in 2017 [9] and later Zhuk [50] also announced another algebraic proof of the conjecture.

It should be remarked that constraint satisfaction problems encompass many well known computational problems, in scheduling, planning, database, artificial intelligence, and constitute an important area of applications, in addition to their interest in theoretical computer science [15, 17, 40, 48].

While the paper of Feder and Vardi [29] did identify some likely candidates for the boundary between easy and hard CSPCSP-s, it was the development of algebraic techniques by Jeavons [41] that lead to the first proposed classification [11]. The algebraic approach depends on the observation that the complexity of CSP(H)CSP(H) only depends on certain symmetries of HH, the so-called polymorphisms of HH. For a digraph HH a polymorphism ϕ\phi of arity kk on HH is a homomorphism from HkH^{k} to HH. Here HkH^{k} is a digraph with vertex set {(a1,a2,,ak)|a1,a2,,akV(H)}\{(a_{1},a_{2},\dots,a_{k})|a_{1},a_{2},\dots,a_{k}\in V(H)\} and arc set {(a1,a2,,ak)(b1,b2,,bk)|aibiA(H) for all 1ik}\{(a_{1},a_{2},\dots,a_{k})(b_{1},b_{2},\dots,b_{k})\ \ |\ \ \ \ a_{i}b_{i}\in A(H)\textnormal{ for all }1\leq i\leq k\}. For a polymorphism ϕ\phi, ϕ(a1,a2,,ak)ϕ(b1,b2,,bk)\phi(a_{1},a_{2},\dots,a_{k})\phi(b_{1},b_{2},\dots,b_{k}) is an arc of HH whenever (a1,a2,,ak)(b1,b2,,bk)(a_{1},a_{2},\dots,a_{k})(b_{1},b_{2},\dots,b_{k}) is an arc of HkH^{k}.

Over time, one concrete classification has emerged as the likely candidate for the dichotomy. It is expressible in many equivalent ways, including the first one proposed in [11]. There were thus a number of equivalent conditions on HH that were postulated to describe which problems CSP(H)CSP(H) are in PP. For each, it was shown that if the condition is not satisfied then the problem CSP(H)CSP(H) is NPNP-complete (see also the survey [33]). One such condition is the existence of a weak near unanimity polymorphism (Maroti and McKenzie [44]). A polymorphism ϕ\phi of HH of arity kk is a kk-near unanimity function (kk-NU) on HH, if ϕ(a,a,,a)=a\phi(a,a,\dots,a)=a for every aV(H)a\in V(H), and ϕ(a,a,,a,b)=ϕ(a,a,,b,a)==ϕ(b,a,,a)=a\phi(a,a,\dots,a,b)=\phi(a,a,\dots,b,a)=\dots=\phi(b,a,\dots,a)=a for every a,bV(H)a,b\in V(H). If we only have ϕ(a,a,,a)=a\phi(a,a,\dots,a)=a for every aV(H)a\in V(H) and ϕ(a,a,,a,b)=ϕ(a,a,,b,a)==ϕ(b,a,,a)\phi(a,a,\dots,a,b)=\phi(a,a,\dots,b,a)=\dots=\phi(b,a,\dots,a) [not necessarily aa] for every a,bV(H)a,b\in V(H), then ϕ\phi is a weak kk-near unanimity function (weak kk-NU). A polymorphism ϕ\phi on HH is Siggers if ϕ(a,r,e,a)=ϕ(r,a,r,e)\phi(a,r,e,a)=\phi(r,a,r,e) for every a,r,eHa,r,e\in H [47]. It has been shown by Siggers [47] that if digraph HH admits a Sigger polymorphism it also admits a weak kk-NU for some k3k\geq 3.

Given the NPNP-completeness proofs that are known, the proof of the Dichotomy Conjecture reduces to the claim that a relational structure \mathcal{H} which admits a weak near unanimity polymorphism has a polynomial time algorithm for CSP()CSP(\mathcal{H}). As mentioned earlier, Feder and Vardi have shown that is suffices to prove this for HOM(H)HOM(H) when HH is a digraph. This is the main result of our paper.

Note that the real difficulty in the proof of the graph dichotomy theorem in [31] lies in proving the NPNP-completeness. By contrast, in the digraph dichotomy theorem proved here it is the polynomial-time algorithm that has proven more difficult.

While the main approach in attacking the conjecture has mostly been to use the highly developed techniques from logic and algebra, and to obtain an algebraic proof, we go in the opposite direction and develop a combinatorial algorithm. Our main result is the following.

Theorem 1.1

Let HH be a digraph that admits a weak near unanimity function. Then HOM(H)HOM(H) is in PP. Deciding whether an input digraph GG admits a homomorphism to HH can be done in time 𝒪(|G|4|H|k+4)\mathcal{O}(|G|^{4}|H|^{k+4}).

Very High Level View

We start with a general digraph HH and a weak kk-NU ϕ\phi of HH. We turn the problem HOM(H)HOM(H) into a related problem of seeking a homomorphism with lists of allowed images. The list homomorphism problem for a fixed digraph HH, denoted LHOM(H)LHOM(H), has as input a digraph GG, and for each vertex xx of GG an associated list (set) of vertices L(x)V(H)L(x)\subseteq V(H), and asks whether there is a homomorphism gg of GG to HH such that for each xV(G)x\in V(G), the image of xx; g(x)g(x), is in L(x)L(x). Such a homomorphism is called a list homomorphism of GG to HH with respect to the lists LL. List homomorphism problems have been extensively studied, and are known to have nice dichotomies [23, 26, 35]. However, we can not use the algorithms for finding list homomorphism from GG to HH, because in the HOM(H)HOM(H) problem, for every vertex xx of GG, L(x)=V(H)L(x)=V(H).

Preprocessing

One of the common ingredients in CSPCSP algorithms is the use of consistency checks to reduce the set of possible values for each variable (see, for example the algorithm outlined in [32] for CSP(H)CSP(H) when HH admits a near unanimity function). Our algorithm includes such a consistency check (also known as (2,3)-consistency check [29]) as a first step which we call PreProcessing. PreProcessing procedure begins by performing arc and pair consistency check on the list of vertices in the input digraph GG. For each pair (x,y)(x,y) of V(G)×V(G)V(G)\times V(G) we consider a list of possible pairs (a,b)(a,b), aL(x)a\in L(x) (the list in HH associated with xV(G)x\in V(G)) and bL(y)b\in L(y). Note that if xyxy is an arc of GG and abab is not an arc of HH then we remove (a,b)(a,b) from the list of (x,y)(x,y). Moreover, if (a,b)L(x,y)(a,b)\in L(x,y) and there exists zz such that there is no cc for which (a,c)L(x,z)(a,c)\in L(x,z) and (c,b)L(z,y)(c,b)\in L(z,y) then we remove (a,b)(a,b) from the list of (x,y)(x,y). We continue this process until no list can be modified. If there are empty lists then clearly there is no list homomorphism from GG to HH.

After PreProcessing

The main structure of the algorithm is to perform pairwise elimination, which focuses on two vertices a,ba,b of HH that occur together in some list L(x),xV(G)L(x),x\in V(G), and finds a way to eliminate aa or bb from L(x)L(x) without changing a feasible problem into an unfeasible one. In other words if there was a list homomorphism with respect to the old lists LL, there will still be one with respect to the updated lists LL. This process continues until either a list becomes empty, certifying that there is no homomorphism with respect to LL (and hence no homomorphism at all), or until all lists become singletons specifying a concrete homomorphism of GG to HH or we reach an instance that has much simpler structure and can be solved by the existing CSP algorithms. This method has been successfully used in other papers [20, 35, 36].

In this paper, the choice of which aa or bb is eliminated, and how, is governed by the given weak near unanimity polymorphism ϕ\phi. The heart of the algorithm is a delicate procedure for updating the lists L(x)L(x) in such a way that (i) feasibility is maintained, and the polymorphism ff keep its initial property (which is key to maintaining feasibility).

Meta-Question

An interesting question arising from the study of CSP Dichotomy theorem is known as the meta-question. Given a relational structure \mathcal{H}, decide whether or not \mathcal{H} admits a polymorphism from a class–for various classes of polymorphims. For many cases hardness results are known. Semmilattice, majority, Maltsev, NU, and weak NU, are among the popular polymorphisms when it comes to study of CSP. Having one or more of these polymorphisms on relation \mathcal{H}, would make the CSP(\mathcal{H}) (or variation) instance tractable. Therefore, knowing structural characterization and polynomial time recognition for these polymorphisms would help in designing efficient algorithms for solving CSP. A binary polymorphism ff on \mathcal{H} is called semilattice if f(a,b)=f(b,a)f(a,b)=f(b,a), and f(a,a)=af(a,a)=a, f(a,f(a,c))=f(f(a,b),c)f(a,f(a,c))=f(f(a,b),c) for every a,b,cV()a,b,c\in V(\mathcal{H}). A ternary polymorphism gg on \mathcal{H} is majority if g(a,a,a)=g(a,a,b)=g(a,b,a)=g(b,a,a)=ag(a,a,a)=g(a,a,b)=g(a,b,a)=g(b,a,a)=a. A polymorphism hh of arity three on \mathcal{H} is called Maltsev if for every a,bV()a,b\in V(\mathcal{H}), h(a,a,a)=h(a,b,b)=h(b,b,a)=ah(a,a,a)=h(a,b,b)=h(b,b,a)=a.

It was shown in [14] that deciding if a relational structure admits any of the following polymorphism is NP-complete; a semilattice polymorphism, a conservative semilattice polymorphism, a commutative, associative polymorphism (that is, a commutative semigroup polymorphism). However, when \mathcal{H} is a single binary relation(digraph) then deciding whether \mathcal{H} admits a conservative semmilattice is polynomial time solvable [34]. Relational structure and digraphs with majority/ near unanimity polymorphism have studied in [5, 14, 27, 35, 37, 44].

One remaining open question is whether the existence of a weak NU polymorphism for a given relational structure can be decided in polynomial time [6]. We transform this problem into a graph list homomorphism problem from an input graph GG to a target graph HH, in which G×H4G\times H^{4} admits a Siggers polymorphism (i.e. a weak NU polymorphism of arity kk for some k3k\geq 3) with respect to the lists. To solve this problem, we need some modules of our algorithm for finding a homomorphism from GG to HH when HH admits a weak NU. Moreover, we also need an algorithm for solving the list homomorphism problem from an input graph GG to a target graph HH where G×H3G\times H^{3} admits a Maltsve polymorphism with respect to the lists; such an algorithm would only assume the existence of a Maltsev polymorphism without knowing the actual values. The later algorithm has been designed in [38]. Deciding whether a relational structure admits a Malstve polymorphims has been an open problem [6, 47]. We prove the following theorem.

Theorem 1.2

Let \mathcal{R} be a relational structure. Then the problem of deciding whether \mathcal{R} admits a weak NU polymorphism is polynomial time solvable.

1.1 Addressing the issue with the 2017 manuscript

Our algorithm (in manuscript 2017) makes a decision based on the output of a test Tx,b,aT_{x,b,a} on a smaller instance of the digraph homomorphism problem. Here a,ba,b are possible images for xV(G)x\in V(G), of a homomorphism from GG to HH.

The algorithm assumes that the test Tx,b,aT_{x,b,a} outputs“yes” and based on the correctness of the test, aa is removed from further consideration for xx. The test Tx,b,aT_{x,b,a} uses the properties of the weak NU polymorphism ϕ\phi. However, it is conceivable that the test Tx,b,aT_{x,b,a} fails, and this means we should not remove aa from the list of possible images of xx. We had incorrectly claimed in the manuscript that the properties of ϕ\phi and pre-tests in the algorithm guarantee the test always passes. But we can construct such an example where the test must fail in the algorithm as follows. Let HH be a digraph with two weakly connected components H1,H2H_{1},H_{2}. The weak NU polymorphism ϕ\phi could be of arity three and such that for every aH1a\in H_{1} and every bH2b\in H_{2}, ϕ(a,b,b)=ϕ(b,b,a)=ϕ(b,a,b)=c\phi(a,b,b)=\phi(b,b,a)=\phi(b,a,b)=c for some cH2c\in H_{2}. Suppose there exists a homomorphism from GG (weakly connected) to HH that maps xx to aa and hence the entire graph GG must be mapped to H1H_{1}. Moreover, suppose there is no homomorphism from GG to H2H_{2}. The algorithm does consider the test Tx,b,aT_{x,b,a} eventually for such GG and HH. According to the test Tx,b,aT_{x,b,a}, we remove aa from further consideration for xx which leads us to remove the possible homomorphism from GG to HH.

Note that one can assume HH is weakly connected as follows. Suppose H1,H2H_{1},H_{2} are balanced digraphs with \ell levels (we can partitioned the vertices of HiH_{i}, i=1,2i=1,2, into \ell parts where all the arcs of HiH_{i} go from a vertex in some part jj to part j+1j+1). An extra vertex aa^{\prime} can be added and connected to all the vertices of H1,H2H_{1},H_{2} on the lowest level. This way we obtain the weakly connected digraph H=H1H2{a}H=H_{1}\cup H_{2}\cup\{a^{\prime}\} with +1\ell+1 levels. We may assume GG is also balanced and has \ell levels. An extra vertex xx^{\prime} can be added to GG with arcs to every vertex of GG on the lowest level. Now G=G{x}G^{\prime}=G\cup\{x^{\prime}\} is also a balanced digraph with +1\ell+1 levels. Note that in any homomorphism from GG^{\prime} to HH, xx^{\prime} must be mapped to aa^{\prime} and any other vertex of GG^{\prime} must map to H{x}H-\{x\}.

We note that Ross Willard has posted a concrete counter-example (and further discussion of his example) for which HH contains 197 vertices in HH. The example inspired by instances of the CSP, so-called Semi-lattice block Maltsev. In Subsection 3.1 and Section 6, we discuss these kinds of examples in detail and show how our new algorithm handles these examples.

2 Necessary Definitions

An oriented walk (path) is obtained from a walk (path) by orienting each of its edges. The net-length of a walk WW, is the number of forward arcs minus the number of backward arcs following WW from the beginning to the end. An oriented cycle is obtained from a cycle by orienting each of its edges. We say two oriented walks X,YX,Y are congruent if they follow the same patterns of forward and backward arcs.

For kk digraphs G1,G2,,GkG_{1},G_{2},\dots,G_{k}, let G1×G2××GkG_{1}\times G_{2}\times\dots\times G_{k} be the digraph with vertex set {(x1,x2,,xk)|xiV(Gi),1ik}\{(x_{1},x_{2},\dots,x_{k})|x_{i}\in V(G_{i}),1\leq i\leq k\} and arc set {(x1,x2,,xk)(x1,x2,,xk)|xixiA(Gi),1ik}\{(x_{1},x_{2},\dots,x_{k})(x^{\prime}_{1},x^{\prime}_{2},\dots,x^{\prime}_{k})|x_{i}x^{\prime}_{i}\in A(G_{i}),1\leq i\leq k\}. Let Hk=H×H×HH^{k}=H\times H\times\dots H, kk times.

Given digraphs GG and HH, and L:G2HL:G\rightarrow 2^{H}, let G×LHkG\times_{L}H^{k} be the induced sub-digraph of G×HkG\times H^{k} with the vertices (y;a1,a2,,ak)(y;a_{1},a_{2},\dots,a_{k}) where a1,a2,,akL(y)a_{1},a_{2},\dots,a_{k}\in L(y).

Definition 2.1 (Homomorphism consistent with Lists)

Let GG and HH be digraphs and list function L:V(G)2HL:V(G)\rightarrow 2^{H}, i.e. list of xV(G)x\in V(G), L(x)V(H)L(x)\subseteq V(H). Let k>1k>1 be an integer.

A function f:G×LHkHf:G\times_{L}H^{k}\rightarrow H is a list homomorphism with respect to lists LL if the following hold.

  • List property : for every (x;a1,a2,,ak)G×LHk(x;a_{1},a_{2},\dots,a_{k})\in G\times_{L}H^{k}, f(x;a1,a2,,ak)L(x)f(x;a_{1},a_{2},\dots,a_{k})\in L(x)

  • Adjacency property: if (x;a1,,ak)(y;b1,,bk)(x;a_{1},...,a_{k})(y;b_{1},...,b_{k}) is an arc of G×LHkG\times_{L}H^{k} then
    f(x;a1,,ak)f(y;b1,,bk)f(x;a_{1},...,a_{k})f(y;b_{1},...,b_{k}) is an arc of HH.

In addition if ff has the following property then we say ff has the weak kk-NU property.

  • for every xV(G),{a,b}L(x)x\in V(G),\{a,b\}\subseteq L(x), we have f(x;a,b,b,,b)=f(x;b,a,b,,b)==f(x;b,b,b,a)f(x;a,b,b,...,b)=f(x;b,a,b,...,b)=...=f(x;b,b,b,...a).

  • for every xV(G)x\in V(G), aL(x)a\in L(x), we have f(x;a,a,,a)=af(x;a,a,\dots,a)=a.

We note that this definition is tailored to our purposes and in particular differs from the standard definition of weak kk-NU as follows. ff is based on two digraphs GG and HH rather than just HH (we think of this as starting with a traditional weak kk-NU on HH and then allowing it to vary somewhat for each xV(G)x\in V(G)).

Notation

For simplicity let (bk,a)=(b,b,,b,a)(b^{k},a)=(b,b,\dots,b,a) be a kk-tuple of all bb’s but with an aa in the kthk^{th} coordinate. Let (x;bk,a)(x;b^{k},a) be a (k+1)(k+1)-tuple of xx, (k1)(k-1) bb’s and aa in the (k+1)th(k+1)^{th} coordinate.

Definition 2.2 (ff-closure of a list)

We say a set SL(y)S\subseteq L(y) is closed under ff if for every kk-tuple (a1,a2,,ak)Sk(a^{\prime}_{1},a^{\prime}_{2},\dots,a^{\prime}_{k})\in S^{k} we have f(y;a1,a2,,ak)Sf(y;a^{\prime}_{1},a^{\prime}_{2},\dots,a^{\prime}_{k})\in S. For set SL(y)S\subseteq L(y), let f^y,SL(y)\widehat{f}_{y,S}\subseteq L(y) be a minimal set that includes all the elements of SS and it is closed under ff.

Let X:x1,x2,,xnX:x_{1},x_{2},\dots,x_{n} be an oriented path in GG. Let X[xi,xj]X[x_{i},x_{j}], 1ijn1\leq i\leq j\leq n, denote the induced sub-path of XX from xix_{i} to xjx_{j}. Let L(X)L(X) denote the vertices of HH that lie in the list of the vertices of XX.

Definition 2.3 (induced bi-clique)

We say two vertices x,yx,y induced a bi-clique if there exist vertices a1,a2,,arL(x)a_{1},a_{2},\dots,a_{r}\in L(x), r>1r>1 and b1,b2,,bsL(y)b_{1},b_{2},\dots,b_{s}\in L(y) such that (ai,bj)L(x,y)(a_{i},b_{j})\in L(x,y) for every 1ir1\leq i\leq r and 1js1\leq j\leq s.

Refer to caption
Figure 1: An example of a Bi-clique

Let a1,a2L(x)a_{1},a_{2}\in L(x) and suppose there exist b1,b2L(y)b_{1},b_{2}\in L(y) such that (a1,b1),(a1,b2),(a2,b1),(a2,b2)L(x,y)(a_{1},b_{1}),(a_{1},b_{2}),(a_{2},b_{1}),(a_{2},b_{2})\in L(x,y). Then it follows from the property of ff, that f^x,{a1,a2}\widehat{f}_{x,\{a_{1},a_{2}\}} and f^y,{b1,b2}\widehat{f}_{y,\{b_{1},b_{2}\}} induce a bi-clique on x,yx,y.

Definition 2.4 (weakly connected component in lists LL )

By connected component of G×LHG\times_{L}H we mean a weakly connected component CC of digraph G×LHG\times_{L}H(i.e. a connected component of G×LHG\times_{L}H when we ignore the direction of the arcs) which is closed under (2,3)(2,3)-consistency. That means, for every (x,a),(y,b)C(x,a),(y,b)\in C, and every zV(G)z\in V(G) there is some cL(z)c\in L(z) such that (a,c)L(x,z)(a,c)\in L(x,z), (b,c)L(y,z)(b,c)\in L(y,z).

Observation 2.5

If there exists a homomorphism g:GHg:G\rightarrow H then all the vertices (y,g(y))(y,g(y)), yV(G)y\in V(G) belong to the same connected component of G×LHG\times_{L}H.

Definition 2.6

For a,bL(x)a,b\in L(x) we say (b,a)(b,a) is a non-minority pair if f(x;bk,a)af(x;b^{k},a)\neq a. Otherwise, we say (b,a)(b,a) is a minority pair.

Definition 2.7

For xV(G)x\in V(G), aL(x)a\in L(x), let Lx,aL_{x,a} be the subset of lists LL that are consistent with xx and aa. In other words, for every yV(G)y\in V(G), Lx,a(y)={bL(y)|(a,b)L(x,y)}L_{x,a}(y)=\{b\in L(y)|(a,b)\in L(x,y)\}. Note that by definition Lx,a(x)={a}L_{x,a}(x)=\{a\}. In general for x1,x2,,xtV(G)x_{1},x_{2},\dots,x_{t}\in V(G), let Lx1,a1,x2,a2,,xt,atL_{x_{1},a_{1},x_{2},a_{2},\dots,x_{t},a_{t}} be the subset of lists LL that are consistent with all the aiL(xi)a_{i}\in L(x_{i})’s, 1it1\leq i\leq t. In other words, for every yV(G)y\in V(G), Lx1,a1,x2,a2,,xt,at(y)={bL(y)|(ai,b)L(xi,y),i=1,2,,t}L_{x_{1},a_{1},x_{2},a_{2},\dots,x_{t},a_{t}}(y)=\{b\in L(y)|(a_{i},b)\in L(x_{i},y),i=1,2,\dots,t\}.

3 Algorithm

The main algorithm starts with applying the Preprocessing procedure on the instance G,H,L,ϕG,H,L,\phi, where ϕ\phi is a weak NU polymorphism of arity kk on HH. If we encounter some empty (pair) lists then there is no homomorphism from GG to HH, and the output is no. Otherwise, it defines the weak NU list homomomorphism f:G×LHkHf:G\times_{L}H^{k}\rightarrow H, by setting f(x;a1,a2,,ak)=ϕ(a1,a2,,ak)f(x;a_{1},a_{2},\dots,a_{k})=\phi(a_{1},a_{2},\dots,a_{k}) for every xGx\in G and every a1,a2,,akL(x)a_{1},a_{2},\dots,a_{k}\in L(x). Then it proceeds with the Not-Minority algorithm (Algorithm 2). Inside the Not-Minority algorithm we look for the special cases, the so-called minority cases which are turned into a Maltsev instances, and can be handled using the existing Maltsev algorithms.

Algorithm 1 The main algorithm for solving the digraph homomorphism problem
1:Input: Digraphs G,HG,H, and, a weak NU homomorphism ϕ:HkH\phi:H^{k}\rightarrow H
2:function DigraphHom(G,H,ϕG,H,\phi)
3:     for all xV(G)x\in V(G), let L(x)=V(H)L(x)=V(H)
4:     if  PreProcessing(G,H,LG,H,L) is false then return ”no homomorphism”      
5:     for all xV(G)x\in V(G) and a1,,akL(x)a_{1},...,a_{k}\in L(x), let f(x;a1,,ak)=ϕ(a1,,ak)f(x;a_{1},...,a_{k})=\phi(a_{1},...,a_{k})
6:     g=g=Not-Minority(G,H,L,fG,H,L,f)
7:     if  gg is not empty  then return true
8:     else return false      
1:Input: Digraphs G,HG,H, lists LL and, a weak NU homomorphism f:G×LHkHf:G\times_{L}H^{k}\rightarrow H which is minority
2:function RemoveMinority(G,H,L,fG,H,L,f )
3:     for all  xV(G)x\in V(G), and a,b,cL(x)a,b,c\in L(x)  do
4:         Set h(x;a,b,c)=f(x;a,b,b,,b,c)h(x;a,b,c)=f(x;a,b,b,\dots,b,c)      
5:     gg=Maltsev-Algorithm(G,H,L,hG,H,L,h)
6:     return gg

Minority Instances

Inside function Not-Minority we first check whether the instance is Maltsev or Minority instance – in which we have a homomorphism ff consistent with LL such that for every a,bL(x)a,b\in L(x), (b,a)(b,a) is a minority pair, i.e. f(x;bk,a)=af(x;b^{k},a)=a, and in particular when a=ba=b we have f(x;a,a,,a)=af(x;a,a,\dots,a)=a (idempotent property).

In our setting a homomorphism h:G×LH3Hh:G\times_{L}H^{3}\rightarrow H is called Maltsev list homomorphism if h(x;a,a,b)=h(x;b,a,a)=bh(x;a,a,b)=h(x;b,a,a)=b for every a,bL(x)a,b\in L(x), xV(G)x\in V(G).

Let G,H,L,fG,H,L,f be an input to our algorithm, and suppose all the pairs are minority pairs. We define a homomorphism h:G×LH3Hh:G\times_{L}H^{3}\rightarrow H (consistent with LL) by setting h(x;a,b,c)=f(x;a,b,b,,b,c)h(x;a,b,c)=f(x;a,b,b,\dots,b,c) for a,b,cL(x)a,b,c\in L(x). Note that since ff has the minority property for all xV(G)x\in V(G), a,bL(x)a,b\in L(x), hh is a Maltsev homomorphism consistent with the lists LL. This is because when b=cb=c then h(x;a,b,b)=f(x;a,b,,b)=ah(x;a,b,b)=f(x;a,b,\dots,b)=a, and when a=ba=b, h(x;a,a,c)=f(x;b,b,,b,c)=ch(x;a,a,c)=f(x;b,b,\dots,b,c)=c, for every a,ca,c, and hence, h(x;b,b,a)=ah(x;b,b,a)=a.

The Maltsev/Minority instances can be solved using the algorithm in [10]. Although the algorithm in [10] assumes there is a global Maltsev, it is straightforward to adopt that algorithm to work in our setting. We can also use the Algorithm in [38].

Not-Minority Instances

Not-Minority algorithm (Algorithm 2) first checks whether the instance is a minority instance, and if the answer is yes then it calls RemoveMinority function. Otherwise, it starts with a not-minority pair (b,a)(b,a) in L(x)L(x), i.e., w=(x;bk,a)w=(x;b^{k},a) with f(w)=caf(w)=c\neq a. Roughly speaking, the goal is not to use ff on vertices w1=(x;e1,e2,,ek)w_{1}=(x;e_{1},e_{2},\dots,e_{k}) with f(w1)=af(w_{1})=a; which essentially means setting f(w1)=f(w)f(w_{1})=f(w). In order to make this assumption, it recursively solves a smaller instance of the problem (smaller test), say GGG^{\prime}\subseteq G, and LLL^{\prime}\subset L, and if the test is successful then that particular information about ff is no longer needed. More precisely, let w=(x;bk,a)G×LHkw=(x;b^{k},a)\in G^{\prime}\times_{L^{\prime}}H^{k} so that f(w)=caf(w)=c\neq a and where (x,a),(x,c)(x,a),(x,c) are in the same connected component of G×LHG^{\prime}\times_{L^{\prime}}H. The test Tx,cT_{x,c} is performed to see whether there exists an LL^{\prime}-homomorphism gg from GG^{\prime} to HH with g(x)=cg(x)=c. If Tx,cT_{x,c} for G,LG^{\prime},L^{\prime} succeeds then the algorithms no longer uses ff for w=(x;a1,a2,,ak)G×LHkw^{\prime}=(x;a_{1},a_{2},\dots,a_{k})\in G^{\prime}\times_{L^{\prime}}H^{k} with f(w)=af(w^{\prime})=a. We often use a more restricted test, say Tx,c,y,dT_{x,c,y,d} on G,LG^{\prime},L^{\prime} in which the goal is to see whether there exists an LL^{\prime}-homomorphism gg, from GG^{\prime} to HH with g(x)=cg(x)=c, g(y)=dg(y)=d.

The Algorithm 2 is recursive, and we use induction on xV(G)|L(x)|\sum_{x\in V(G)}|L(x)| to show its correctness. In what follows we give an insight of why the weak kk-NU (k>2k>2) property of HH is necessary for our algorithm. For contradiction, suppose w1=(x;bk,a)w_{1}=(x;b^{k},a) with f(w1)=cf(w_{1})=c and w2=(x;a,b,b,,b)w_{2}=(x;a,b,b,\dots,b) with f(w2)=df(w_{2})=d. If d=ad=a then in Not-Minority algorithm we try to remove aa from L(x)L(x) (not to use aa in L(x)L(x)) if we start with w1w_{1} while we do need to keep aa in L(x)L(x) because we later need aa in L(x)L(x) for the Maltsev algorithm. It might be the case that dad\neq a but during the execution of Algorithm 2 for some w3=(x;bk,e)w_{3}=(x;b^{k},e) with f(w3)ef(w_{3})\neq e we assume f(w3)f(w_{3}) is ee. So we need to have f(w1)=f(w2)f(w_{1})=f(w_{2}), the weak NU property, to start in Algorithm 1.

Algorithm 2 ruling out not-minority pairs, ff remains a homomorphism of G×LHkG\times_{L}H^{k} to HH and for every xV(G)x\in V(G), a,bL(x)a^{\prime},b^{\prime}\in L(x), we have f(x;ak,b)=bf(x;a^{\prime k},b^{\prime})=b^{\prime}
1:Input: Digraphs G,HG,H, lists LL and, a weak NU homomorphism f:G×LHkHf:G\times_{L}H^{k}\rightarrow H
2:function Not-Minority(G,H,L,fG,H,L,f)
3:     if  \forall xV(G)x\in V(G), |L(x)|=1|L(x)|=1  then \forall xV(G)x\in V(G) set g(x)=L(x)g(x)=L(x)
4:         return gg      
5:     If G×LHG\times_{L}H is not connected then consider each connected component separately
6:     if  all the pairs are minority  then
7:         g=g= RemoveMinority(G,H,L,fG,H,L,f)
8:         return gg      
9:     for all y,zV(G)y,z\in V(G), d1,d2L(y)d_{1},d_{2}\in L(y), e1L(z)e_{1}\in L(z) s.t. (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z)  do
10:         (G,L)=(G^{\prime},L^{\prime})=Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1})
11:         gd1,e1y,z=g^{y,z}_{d_{1},e_{1}}= Not-Minority(G,H,L,fG^{\prime},H,L^{\prime},f)
12:         if  gd1,e1y,zg^{y,z}_{d_{1},e_{1}} is empty  then
13:              Remove (d1,e1)(d_{1},e_{1}) from L(y,z)L(y,z), and remove (e1,d1)(e_{1},d_{1}) from L(z,y)L(z,y)
14:              if L(y,z)L(y,z) is empty then return \emptyset               
15:         else
16:              if G=GG^{\prime}=G then return gd1,e1y,zg^{y,z}_{d_{1},e_{1}}                             
17:     (L,f)=(L,f)=Bi-Clique-Instances(G,H,L,fG,H,L,f)
18:     PreProcessing(G,H,LG,H,L)
19:     if  \exists empty list or \exists empty pair list then return \emptyset
20:     else
21:         g=g= RemoveMinority(G,H,L,fG,H,L,f)
22:         return gg      

For implementation, we update the lists LL as well as the pair lists, depending on the output of Tx,cT_{x,c}. If Tx,cT_{x,c} fails (no LL-homomorphism from GG to HH that maps xx to cc) then we remove cc from L(x)L(x) and if Tx,c,y,dT_{x,c,y,d} fails (no LL-homomorphism from GG to HH that maps xx to cc and yy to dd) then we remove (c,d)(c,d) from L(x,y)L(x,y). The Not-Minority takes G,L,fG,L,f and checks whether all the lists are singleton, and in this case the decision is clear. It also handles each connected component of G×LHG\times_{L}H separately. If all the pairs are minority then it calls RemoveMinority which is essentially checking for a homomorphism when the instance admits a Maltsev polymorphism. Otherwise, it proceeds with function Sym-Diff.

Sym-Diff function

Let y,zV(G)y,z\in V(G) and d1,d2L(y)d_{1},d_{2}\in L(y) and e1L(z)e_{1}\in L(z) such that (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z). Let L1=Lz,e1L_{1}=L_{z,e_{1}}. We consider the instances G,H,L,fG^{\prime},H,L^{\prime},f of the problem as follows. The induced sub-digraph GG^{\prime} consists of vertices vv of GG such that for every (d1,j)L1(y,v)(d_{1},j)\in L_{1}(y,v) we have (d2,j)L1(y,v)(d_{2},j)\not\in L_{1}(y,v). Now for each vGv\in G^{\prime}, L(v)={i(d1,i)L1(y,v)}L^{\prime}(v)=\{i\mid(d_{1},i)\in L_{1}(y,v)\}. Such an instance is constructed by function Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}).

Let B(G)B(G^{\prime}) denote a set of vertices uu in GGG\setminus G^{\prime} that are adjacent (via an out-going or in-coming arc) to some vertex vv in GG^{\prime}. B(G)B(G^{\prime}) is called the boundary of GG^{\prime}. We do not add B(G)B^{\prime}(G^{\prime}) into GG^{\prime} which makes it easier to argue about running time. However, we some extra care it is also possible to have an algorithm that include the boundary vertices. Note that for every vV(G)v\in V(G^{\prime}), |L(v)|<|L(v)||L^{\prime}(v)|<|L(v)|. Moreover, L(z)={e1}L^{\prime}(z)=\{e_{1}\}, and L(y)={d1}L^{\prime}(y)=\{d_{1}\}.

For y,zV(G)y,z\in V(G) and d1,d2L(y)d_{1},d_{2}\in L(y) and e1L(z)e_{1}\in L(z) we solve the instance G,H,L,fG^{\prime},H,L^{\prime},f, by calling the Not-Minority(G,H,L,fG^{\prime},H,L^{\prime},f) function. The output of this function call is either a non-empty LL^{\prime}-homomorphism gd1,e1y,zg^{y,z}_{d_{1},e_{1}} from GG^{\prime} to HH or there is no such homomorphism. If gd1,e1y,zg^{y,z}_{d_{1},e_{1}} does not exist then there is no homomorphism from GG to HH that maps yy to d1d_{1}, and zz to e1e_{1}. In this case we remove (d1,e1)(d_{1},e_{1}) from L(y,z)L(y,z), and remove (e1,d1)(e_{1},d_{1}) from L(z,y)L(z,y). This should be clear because GG^{\prime} is an induced sub-digraph of GG, and for every vertex vV(G){y,z}v\in V(G^{\prime})\setminus\{y,z\}, L(v,z)=L(v,z)L^{\prime}(v,z)=L(v,z), L(v,y)=L(v,y)L^{\prime}(v,y)=L(v,y). Moreover, it is easy to see (will be shown later) that LL^{\prime} is closed under ff. The homomorphism gd1,e1y,zg^{y,z}_{d_{1},e_{1}} is used in the correctness proof of the Algorithm 2.

Implementation Remark:

In order to avoid several redundant tests, when a sub-digraph GG^{\prime} constructed by Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}) is the same as GG; and the test returns true, then we no longer need to run the test for any other sub-instance (G′′,L′′)(G^{\prime\prime},L^{\prime\prime}) because we just need to return yes to the parent sub-routine calling the current sub-routine.

1:Input: Digraphs GG, lists LL and, y,zV(G)y,z\in V(G), d1,d2L(y)d_{1},d_{2}\in L(y), e1L(z)e_{1}\in L(z)
2:function Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1})
3:     Create new empty lists LL^{\prime} and let L1=Lz,e1L_{1}=L_{z,e_{1}}, and construct the pair lists L1×L1L_{1}\times L_{1} from L1L_{1}
4:     Set L(z)=e1L^{\prime}(z)=e_{1}, L(y)=d1L^{\prime}(y)=d_{1}, and set G=G^{\prime}=\emptyset
5:     for all  vV(G)v\in V(G) s.t. i\forall i with (i,d1)L1(v,y)(i,d_{1})\in L_{1}(v,y) we have (i,d2)L1(v,y)(i,d_{2})\not\in L_{1}(v,y)  do
6:         add vv into set GG^{\prime}      
7:     Let GG^{\prime} be the induced sub-digraph of GG
8:     Let B(G)={uV(GG) u is adjacent(in-neighbor or out-neighbor) to some vV(G)}B(G^{\prime})=\{u\in V(G\setminus G^{\prime})\mid\text{ $u$ is adjacent(in-neighbor or out-neighbor) to some $v\in V(G^{\prime})$}\}
9:     for all uV(G)u\in V(G^{\prime}) do
10:         L(u)={i(d1,i)L1(y,u)}L^{\prime}(u)=\{\text{$i\mid(d_{1},i)\in L_{1}(y,u)$}\}      
11:     for all  u,vV(G)u,v\in V(G^{\prime})  do
12:         L(u,v)={(a,b)L1(u,v)|(a,b)isconsistentinG}L^{\prime}(u,v)=\{(a,b)\in L_{1}(u,v)|(a,b)\ \ is\ \ consistent\ \ in\ \ G^{\prime}\}.      
13:     return (G,L)(G^{\prime},L^{\prime})

Bi-clique Instances

When instance I=G×LHI=G\times_{L}H has more than one connected component we consider each connected component separately. Otherwise, there exists a vertex yy and two elements d1,d2L(y)d_{1},d_{2}\in L(y) along with zV(G)z\in V(G), e1L(z)e_{1}\in L(z) such that (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z). Let d=f(y;d2k,d1)d1d=f(y;d_{2}^{k},d_{1})\neq d_{1}. Suppose (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z) after running Not-Minority on the instances from Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}) and Sym-Diff(G,L,y,d2,d1,z,e1G,L,y,d_{2},d_{1},z,e_{1}). Then we remove (d1,e1)(d_{1},e_{1}) from L(y,z)L(y,z) (see Figure 2). We continue this until all the pairs are minority.

After the Bi-clique-Instances function, we update the lists LL by calling PreProcessing, because reducing the pair lists may imply to remove some elements from the lists of some elements of GG. At this point, if aL(x)a\in L(x) then f(x;a,a,,a)=af(x;a,a,\dots,a)=a. This is because when aa is in L(x)L(x) then it means the Not-Minority procedure did not consider aa to be excluded from further consideration. Notice that in order to feed this instance to RemoveMinority we only need the idempotent property for those vertices that are in L(x)L(x), xV(G)x\in V(G).

Refer to caption
Figure 2: Explanation of how to reduce the pair lists.
1:Input: Digraphs GG, lists LL and, a weak NU homomorphism f:G×LHkHf:G\times_{L}H^{k}\rightarrow H
2:function Bi-Clique-Instances(G,H,L,fG,H,L,f )
3:     update=true
4:     while update  do
5:         update=false
6:         Let d1,d2L(y)d_{1},d_{2}\in L(y), and e1L(z)e_{1}\in L(z) such that (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z) and f(y;d2k,d1)d1f(y;d_{2}^{k},d_{1})\neq d_{1}
7:         if  there is such y,z,d1,d2,e1y,z,d_{1},d_{2},e_{1}  then
8:              Remove (d1,e1)(d_{1},e_{1}) from L(y,z)L(y,z) and remove (e1,d1)(e_{1},d_{1}) from L(z,y)L(z,y)
9:              PreProcessing(G,H,LG,H,L)
10:              update=true               
11:     return (L)(L)

3.1 Examples

We refer the reader to the example in [49]. The digraph HH (depicted in Figure 3) admits a weak NU of arity 33. The input digraph GG ( depicted in Figure 4). This digraph contains the original digraph used in [49] as an induced sub-digraph. So, our example here combines both examples used in [49].

Refer to caption
Figure 3: There are oriented paths from 0,1,20,1,2 to any of α,β,γ,σ,τ\alpha,\beta,\gamma,\sigma,\tau
Refer to caption
Figure 4: The input digraph GG

The lists in G×HG\times H are depicted in Figure 5. Clearly the G×LHG\times_{L}H has only one weakly connected component.

Refer to caption
Figure 5: Vertices in the ovals show the elements of HH that are in the list of the vertices in GG, the oriented path between them are according to path Q1,Q2,Q3,Q4Q_{1},Q_{2},Q_{3},Q_{4} in GG. For example, if x1x_{1} is mapped to 0 then t1t_{1} can be mapped to α,β\alpha,\beta.

Now consider the Sym-Diff(G,L,t0,σ,τ,x1,1G,L,t_{0},\sigma,\tau,x^{\prime}_{1},1). According to the construction of Sym-Diff we have, V(G)={x1,t0,x1,x2,x3,x4,x5,x6,t1,t2,t3,t4}V(G^{\prime})=\{x^{\prime}_{1},t_{0},x_{1},x_{2},x_{3},x_{4},x_{5},x_{6},t_{1},t_{2},t_{3},t_{4}\}. This is because (τ,1),(σ,1)L(t0,x1)(\tau,1),(\sigma,1)\in L(t_{0},x^{\prime}_{1}), and hence, GG^{\prime} is not extended to the vertices {x2,x3,x4,x5,x6,t1,t2,t3,t4}\{x^{\prime}_{2},x^{\prime}_{3},x^{\prime}_{4},x^{\prime}_{5},x^{\prime}_{6},t^{\prime}_{1},t^{\prime}_{2},t^{\prime}_{3},t^{\prime}_{4}\}. The list of the vertices in the new instance (LL^{\prime} lists) are as follows. L(x1)={1}L^{\prime}(x^{\prime}_{1})=\{1\}, L(t0)={σ}L^{\prime}(t_{0})=\{\sigma\}, L(t1)={σ,γ}L^{\prime}(t_{1})=\{\sigma,\gamma\}, L(t2)={σ,γ}L^{\prime}(t_{2})=\{\sigma,\gamma\}, L(x1)={1}L^{\prime}(x_{1})=\{1\}, L(x2)=L(x3)=L(x4)=L(x5)=L(x6)={0,1}L^{\prime}(x_{2})=L^{\prime}(x_{3})=L^{\prime}(x_{4})=L^{\prime}(x_{5})=L^{\prime}(x_{6})=\{0,1\}, and L(t3)=L(t4)={α,β,γ,σ}L^{\prime}(t_{3})=L^{\prime}(t_{4})=\{\alpha,\beta,\gamma,\sigma\} (See Figure 6).

Refer to caption
Figure 6: Applying Sym-Diff function on G,L,t0,α,τ,x1,1G,L,t_{0},\alpha,\tau,x^{\prime}_{1},1 and get lists LL^{\prime}

Now suppose we want to solve the instance G,LG^{\prime},L^{\prime}. At this point one could say this instance is Minority and according to Algorithm 2 we should call a Maltsev algorithm. However, we may further apply Algorithm 2 on instances constructed in Sym-Diff and use the ”no” output to decide whether there exists a homomorphism or not. Now consider Sym-Diff(G,L,t4,α,β,x4,0G^{\prime},L^{\prime},t_{4},\alpha,\beta,x_{4},0) (see Figure 7), we would get the digraph G′′={x1,x2,x3,x4,x5,x6}G^{\prime\prime}=\{x_{1},x_{2},x_{3},x_{4},x_{5},x_{6}\} and lists L′′L^{\prime\prime} as follows. L′′(t4)={α}L^{\prime\prime}(t_{4})=\{\alpha\}, L′′(x4)={0}L^{\prime\prime}(x_{4})=\{0\}. By following Q4Q_{4} from t4t_{4} to x3x_{3} we would have L′′(x3)={1}L^{\prime\prime}(x_{3})=\{1\} (because (0,α)L(x3,t4)(0,\alpha)\not\in L^{\prime}(x_{3},t_{4})), and then following Q1Q_{1} to t1t_{1} we would have L′′(t1)={γ}L^{\prime\prime}(t_{1})=\{\gamma\} (because (1,σ)L(x3,t1)(1,\sigma)\not\in L^{\prime}(x_{3},t_{1})). By similar reasoning and following Q2Q_{2} from t1t_{1} to x2x_{2} we have L′′(x2)={0}L^{\prime\prime}(x_{2})=\{0\}, and consequently from x2x_{2} to t3t_{3} alongside Q2Q_{2} we have L′′(t3)={α,γ}L^{\prime\prime}(t_{3})=\{\alpha,\gamma\}. By following Q2Q_{2} from t4t_{4} to x5x_{5} we would have L′′(x5)={0}L^{\prime\prime}(x_{5})=\{0\}, and consequently L′′(t2)={γ}L^{\prime\prime}(t_{2})=\{\gamma\}. By following Q3Q_{3} from t2t_{2} to x6x_{6} we have L′′(x6)={1}L^{\prime\prime}(x_{6})=\{1\}, and continuing along Q3Q_{3} to t3t_{3} we would have L′′(t3)={γ}L^{\prime\prime}(t_{3})=\{\gamma\}.

Refer to caption
Figure 7: Applying Sym-Diff function on G,L,t4,α,β,x4,0G^{\prime},L^{\prime},t_{4},\alpha,\beta,x_{4},0

Finally we see the pair lists L′′(x4,x6)=L^{\prime\prime}(x_{4},x_{6})=\emptyset because (0,1)L′′(x4,x6)(0,1)\not\in L^{\prime\prime}(x_{4},x_{6}). Therefore, there is no L′′L^{\prime\prime}-homomorphism from G′′G^{\prime\prime} to HH. This means in the algorithm we remove (α,0)(\alpha,0) from L(t4,x4)L^{\prime}(t_{4},x_{4}). Moreover, L(α,1)L(t4,x4)L^{\prime}(\alpha,1)\not\in L^{\prime}(t_{4},x_{4}) and hence α\alpha is removed from L′′(t4)L^{\prime\prime}(t_{4}). Similarly we conclude that there is no homomorphism for the instance Sym-Diff(G,L,t4,β,α,x4,0G^{\prime},L^{\prime},t_{4},\beta,\alpha,x_{4},0), and hence, we should remove β\beta from L(t4)L^{\prime}(t_{4}).

Again suppose we call, Sym-Diff(G,L,t4,γ,σ,x4,1G^{\prime},L^{\prime},t_{4},\gamma,\sigma,x_{4},1). We would get digraph D1D_{1} with vertex set {x1,x2,x3,x4,x5,x6}\{x_{1},x_{2},x_{3},x_{4},x_{5},x_{6}\} and lists L1L_{1} as follows. L1(t4)={α}L_{1}(t_{4})=\{\alpha\}, L1(x4)={1}L_{1}(x_{4})=\{1\}, L1(x3)={0}L_{1}(x_{3})=\{0\}, L1(t1)={σ}L_{1}(t_{1})=\{\sigma\}, L1(x2)={1}L_{1}(x_{2})=\{1\}. L1(x5)={0}L_{1}(x_{5})=\{0\}, L1(t2)={γ}L_{1}(t_{2})=\{\gamma\}, L1(x6)={1}L_{1}(x_{6})=\{1\}, and L1(t3)={β}L_{1}(t_{3})=\{\beta\}. Now we see the pairs lists L1(t3,x4)=L_{1}(t_{3},x_{4})=\emptyset because (β,1)L(t3,x4)(\beta,1)\not\in L^{\prime}(t_{3},x_{4}). Therefore, we conclude γ\gamma should be removed from L(t4)L^{\prime}(t_{4}). By similar argument, we conclude that σ\sigma is removed from L(t4)L^{\prime}(t_{4}).

In conclusion, there is no LL-homomorphism that maps x1x_{1} to 11. By symmetry we conclude that there is no LL-homomorphims that maps x1x_{1} to zero. This means L(x1)=L(x2)=L(x3)=L(x4)=L(x5)=L(x6)={2}L(x_{1})=L(x_{2})=L(x_{3})=L(x_{4})=L(x_{5})=L(x_{6})=\{2\}. L(t1)=L(t2)=L(t3)=L(t4)={τ}L(t_{1})=L(t_{2})=L(t_{3})=L(t_{4})=\{\tau\}. So any homomorphism ϕ\phi from GG to HH maps xix_{i}, 1i61\leq i\leq 6 to 22 and it maps tit_{i}, 1i41\leq i\leq 4 to τ\tau.

It is easy to verify that ϕ\phi may map all the vertices x1,x2,x3,x4,x5,x6x^{\prime}_{1},x^{\prime}_{2},x^{\prime}_{3},x^{\prime}_{4},x^{\prime}_{5},x^{\prime}_{6} to 22, and there also exists a homomorphism ϕ\phi^{\prime} where the image of x1,x2,x3,x4,x5,x6x^{\prime}_{1},x^{\prime}_{2},x^{\prime}_{3},x^{\prime}_{4},x^{\prime}_{5},x^{\prime}_{6} is in {0,1}\{0,1\}.

Generalization

Let RR be a relation of arity kk on set AA, and suppose RR admits a weak NU polymorphism ϕ\phi of arity 33 (for simplicity). Let α1,α2,,αm\alpha_{1},\alpha_{2},\dots,\alpha_{m} be the tuples in RR. Let a1,a2,,ana_{1},a_{2},\dots,a_{n} be the elements of AA. Let αj=(c1,c2,,ck)\alpha_{j}=(c_{1},c_{2},\dots,c_{k}) be the jj-tuple, 1jm1\leq j\leq m of RR. Let Pi,jP_{i,j} be an oriented path that is constructed by concatenating k+2k+2 smaller pieces (oriented path) where each piece is either a forward arc or a forward-backward-forward arc. The first piece of Pi,jP_{i,j} is a forward arc and the k+2k+2-piece is also a forward arc. The rr-th piece, 2rk2\leq r\leq k, is a forward arc if ai=cra_{i}=c_{r}, otherwise, the rr-th piece is a forward-backward-forward arc; and in this case we say the rr-th piece has two internal vertices. Note that (r+1)(r+1)-the piece is attached to the end of the rr-th piece. For example, if a1=0a_{1}=0 and α1=(0,0,0,1,0)\alpha_{1}=(0,0,0,1,0) then P1,1P_{1,1} looks like :

Refer to caption
Figure 8: The oriented path corresponding to (0,0,0,1,0)(0,0,0,1,0)

Now HH is constructed as follows. V(H)V(H) consists of b1,b2,,bnb_{1},b_{2},\dots,b_{n} corresponding to a1,a2,,ana_{1},a_{2},\dots,a_{n}, together with vertices β1,β2,,βm\beta_{1},\beta_{2},\dots,\beta_{m} corresponding to α1,α2,,αm\alpha_{1},\alpha_{2},\dots,\alpha_{m}. For every 1in1\leq i\leq n, 1jm1\leq j\leq m, we put a copy of Pi,jP_{i,j} between the vertices bib_{i} and βj\beta_{j}; identifying the beginning of Pi,jP_{i,j} with bib_{i} and end of Pi,jP_{i,j} with βj\beta_{j}.

Now it is easy to show that the resulting digraph HH is a balanced digraph and admits a weak NU polymorphism. For every triple (bi,bj,b)(b_{i},b_{j},b_{\ell}) from b1,b2,,bnb_{1},b_{2},\dots,b_{n} set ψ(bi,bj,b)=bs\psi(b_{i},b_{j},b_{\ell})=b_{s} where as=ϕ(ai,aj,a)a_{s}=\phi(a_{i},a_{j},a_{\ell}). For every βi,βj,β\beta_{i},\beta_{j},\beta_{\ell} from {β1,β2,,βm}\{\beta_{1},\beta_{2},\dots,\beta_{m}\}, set ψ(βi,βj,β)=βs\psi(\beta_{i},\beta_{j},\beta_{\ell})=\beta_{s} where αs=ϕ(αi,αj,α)\alpha_{s}=\phi(\alpha_{i},\alpha_{j},\alpha_{\ell}) where ϕ\phi is applied coordinate wise on (αi,αj,α)(\alpha_{i},\alpha_{j},\alpha_{\ell}). We give level to the vertices of HH. All the vertices, b1,b2,,bnb_{1},b_{2},\dots,b_{n} gets level zero. If uvuv is an arc of HH then level(v)=1+level(u)level(v)=1+level(u). All the β1,β2,,βm\beta_{1},\beta_{2},\dots,\beta_{m} vertices gets level k+2k+2. For every a,b,cV(H)a,b,c\in V(H), set ψ(a,b,c)=a\psi(a,b,c)=a when a,b,ca,b,c are not on the same level of HH. Otherwise, for aPi,ia\in P_{i,i^{\prime}} and bPj,jb\in P_{j,j^{\prime}}, and cP,c\in P_{\ell,\ell^{\prime}} where all on level hh of HH, set ψ(a,b,c)=d\psi(a,b,c)=d where dd has the following properties:

  • dd is a vertex on the same level as a,b,ca,b,c,

  • dd lies on Ps,sP_{s,s^{\prime}} where ϕ(ai,aj,a)=as\phi(a_{i},a_{j},a_{\ell})=a_{s} and ϕ(αi,αj,α)=αs\phi(\alpha_{i^{\prime}},\alpha_{j^{\prime}},\alpha_{\ell^{\prime}})=\alpha_{s^{\prime}},

  • if any of the aPi,ia\in P_{i,i^{\prime}}, bPj,jb\in P_{j,j^{\prime}}, and cP,c\in P_{\ell,\ell^{\prime}} is an interval vertex (reffering to the r-th piece of PP) then dd is also an interval vertex of Ps,sP_{s,s^{\prime}} when exists. Otherwise dd should not be an internal.

  • if i=j=i=j=\ell and i=j=i^{\prime}=j^{\prime}=\ell^{\prime}, then ψ(a,b,c)=a\psi(a,b,c)=a if a=ba=b or a=ca=c, otherwise, ψ(a,b,c)=b\psi(a,b,c)=b (i.e., the majority function).

Suppose aa,bb,ccaa^{\prime},bb^{\prime},cc^{\prime} are arcs of HH. By the following observation, it is easy to see that ψ(a,b,c)ψ(a,b,c)\psi(a,b,c)\psi(a^{\prime},b^{\prime},c^{\prime}) is an arc of HH.

Observation. Suppose a,b,ca,b,c are at the beginning (end) of the rr-th piece of Pi,iP_{i,i^{\prime}} and bPj,jb\in P_{j,j^{\prime}}, and cP,c\in P_{\ell,\ell^{\prime}} (respectively) and none of these three pieces has an interval vertex. Then, the rr-th piece of Ps,sP_{s,s^{\prime}} does not an interval vertex.

By definition aia_{i} appears in the rr-th coordinate of αi\alpha_{i^{\prime}}, and aja_{j} appear in the rr-th coordinate of αj\alpha_{j^{\prime}}, and aa_{\ell} appears in the rr-th coordinate of α\alpha_{\ell^{\prime}}. Since ϕ\phi is applied coordinate wise on (αi,αj,α)(\alpha_{i^{\prime}},\alpha_{j^{\prime}},\alpha_{\ell^{\prime}}), the rr-th coordinate of αs\alpha_{s^{\prime}} is ϕ(ai,aj,a)=as\phi(a_{i},a_{j},a_{\ell})=a_{s}, and hence, the rr-th coordinate of αs\alpha_{s^{\prime}} is asa_{s}. Therefore, the rr-th piece of Ps,sP_{s,s^{\prime}} doesn’t have an interval vertex.

4 Proof of Theorem 1.1

By Lemma 4.3, we preserve the existence of a homomorphism from GG to HH after Algorithm. We observe that the running time of PreProcessing function is 𝒪(|G|3|H|3)\mathcal{O}(|G|^{3}|H|^{3}). According to the proof of Lemma 4.3 (2) the running time of Algorithm 2 is 𝒪(|G|4|H|k+4)\mathcal{O}(|G|^{4}|H|^{k+4}). Therefore, the running time of the Algorithm 1 is 𝒪(|G|4|H|k+4)\mathcal{O}(|G|^{4}|H|^{k+4}).

4.1 PreProcessing and List Update

We first show that the standard properties of consistency checking remain true in our setting – namely, that if the Preprocessing algorithm succeeds then ff remains a homomorphism consistent with the lists LL if it was before the Preprocessing.

Lemma 4.1

If ff is a homomorphism of G×HkHG\times H^{k}\rightarrow H consistent with LL then ff is a homomorphism consistent with LL after running the Preprocessing.

Proof: We need to show that if a1,a2,,aka_{1},a_{2},\dots,a_{k} are in L(y)L(y) after the Preprocessing then
f(y;a1,a2,,ak)L(y)f(y;a_{1},a_{2},\dots,a_{k})\in L(y) after the Preprocessing. By definition vertex aa is in L(y)L(y) after the Preprocessing because for every oriented path YY (of some length mm) in GG from yy to a fixed vertex zV(G)z\in V(G) there is a vertex aL(z)a^{\prime}\in L(z) and there exists a walk BB in HH from aa to aa^{\prime} and congruent with YY that lies in L(Y)L(Y); list of the vertices of YY. Let a1,a2,a3,,akL(z)a^{\prime}_{1},a^{\prime}_{2},a^{\prime}_{3},\dots,a^{\prime}_{k}\in L(z). Let AiA_{i}, 1ik1\leq i\leq k be a walk from aia_{i} to aia^{\prime}_{i} in L(Y)L(Y) and congruent to YY. Let Ai=ai,a1i,ai2,,aim,aiA_{i}=a_{i},a_{1}^{i},a^{2}_{i},\dots,a^{m}_{i},a^{\prime}_{i} and let Y=y,y1,y2,,ym,zY=y,y_{1},y_{2},\dots,y_{m},z. Since ff is a homomorphism consistent with LL before the Preprocessing, f(y;a1,a2,,ak),f(y1;a11,a21,,ak1),,f(y;a_{1},a_{2},\dots,a_{k}),f(y_{1};a_{1}^{1},a_{2}^{1},\dots,a_{k}^{1}),\dots, f(yi;a1i,a2i,,aki),,f(ym;a1m,a2m,,akm),f(z;a1,a2,,ak)f(y_{i};a_{1}^{i},a_{2}^{i},\dots,a_{k}^{i}),\dots,f(y_{m};a_{1}^{m},a_{2}^{m},\dots,a_{k}^{m}),\\ f(z;a^{\prime}_{1},a^{\prime}_{2},\dots,a^{\prime}_{k}) is a walk congruent with YY. This would imply that there is a walk from f(y;a1,a2,,ak)f(y;a_{1},a_{2},\dots,a_{k}) to f(z;a1,a2,,ak)f(z;a^{\prime}_{1},a^{\prime}_{2},\dots,a^{\prime}_{k}) congruent with YY in L(Y)L(Y), and hence, f(y;a1,a2,,ak)L(y)f(y;a_{1},a_{2},\dots,a_{k})\in L(y). \diamond

By a similar argument as in the proof of Lemma 4.1 we have the following lemma.

Lemma 4.2

If ff is a homomorphism of G×HkHG\times H^{k}\rightarrow H, consistent with LL and (ai,bi)L(x,y)(a_{i},b_{i})\in L(x,y), 1ik1\leq i\leq k, after Preprocessing then (f(x;a1,a2,,ak),f(y;b1,b2,,bk))L(x,y)(f(x;a_{1},a_{2},\dots,a_{k}),f(y;b_{1},b_{2},\dots,b_{k}))\in L(x,y) after the Preprocessing.

4.2 Correctness Proof for Not-Minority Algorithm

The main argument is proving that after Not-Minority algorithm ( Algorithm 2), there still exists a homomorphism from GG to HH if there was one before Not-Minority .

Lemma 4.3

If (d1,e1)L(y,z)(d_{1},e_{1})\in L(y,z) after calling Not-Minority(G1,H,L1,fG_{1},H,L_{1},f) where (G1,L1)=(G_{1},L_{1})= Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}), then set test1=truetest_{1}=true, otherwise, set test1=falsetest_{1}=false. If (d2,e1)L(y,z)(d_{2},e_{1})\in L(y,z) after calling Not-Minority(G2,H,L2,fG_{2},H,L_{2},f) where (G2,L2)=(G_{2},L_{2})= Sym-Diff(G,L,y,d2,d1,z,e1G,L,y,d_{2},d_{1},z,e_{1}), then set test2=truetest_{2}=true, otherwise, set test2=falsetest_{2}=false. Then the following hold.

  1. α.\alpha.

    If test1test_{1} is false then there is no homomorphism from GG to HH that maps yy to d1d_{1} and zz to e1e_{1}.

  2. β.\beta.

    If test2test_{2} is false then there is no homomorphism from GG to HH that maps yy to d2d_{2} and zz to e1e_{1}.

  3. γ.\gamma.

    If both test1,test2test_{1},test_{2} are true then there exists an LL-homomorphism from G1=G2G_{1}=G_{2} to HH, that maps yy to dd and zz to e1e_{1} where f(y;d2k,d1)=dd1f(y;d_{2}^{k},d_{1})=d\neq d_{1}. Moreover, Not-Minority returns an LL^{\prime}- homomorphism from GG^{\prime} to HH where (G,L)=(G^{\prime},L^{\prime})=Sym-Diff(G,L,y,d,d1,z,e1G,L,y,d,d_{1},z,e_{1}).

  4. λ.\lambda.

    Suppose both test1,test2test_{1},test_{2} are true, and f(y;d2k,d1)=dd1f(y;d_{2}^{k},d_{1})=d\neq d_{1}. Suppose there exists a homomorphism gg from GG to HH with g(y)=d1g(y)=d_{1} and g(z)=e1g(z)=e_{1}. Then there exists a homomorphism hh from GG to HH with h(y)=dh(y)=d and h(z)=e1h(z)=e_{1}.

Proof: We use induction on the xV(G)|L(x)|\sum_{x\in V(G)}|L(x)|. The base case of the induction is when all the lists are singleton, or when all the pairs are minority. If the lists are singleton then at the beginning of Not-Minority algorithm we check whether the singleton lists form a homomorphism from GG to HH. If all the pairs are minority (f(x,a1k,a2)=a2f(x,a_{1}^{k},a_{2})=a_{2} for every xV(G)x\in V(G), a1,a2L(x)a_{1},a_{2}\in L(x)) then the function RemoveMinority inside Not-Minority algorithm, correctly returns a homomorphism from GG to HH if there exists one (see lines 68 of Algorithm RemoveMinority 2).
Therefore, we continue by assuming the existence of some not-minority pairs. Consider the instance G1,L1G_{1},L_{1} constructed by Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}) in which L1(y)={d1}L_{1}(y)=\{d_{1}\} and L1(z)={e1}L_{1}(z)=\{e_{1}\}.

Proof of (α\alpha) We first notice that ff is closed under L1L_{1}. Let vG1v\in G_{1} and suppose c1,c2,,ckL1(v)c_{1},c_{2},\dots,c_{k}\in L_{1}(v). Thus, we have (c1,d1),(c2,d1),,(ck,d1)L(v,y)(c_{1},d_{1}),(c_{2},d_{1}),\dots,(c_{k},d_{1})\in L(v,y), and (c1,e1),(c2,e1),,(ck,e1)L(v,z)(c_{1},e_{1}),(c_{2},e_{1}),\dots,(c_{k},e_{1})\in L(v,z). Let P1=v,v1,v2,,vt,yP_{1}=v,v_{1},v_{2},\dots,v_{t},y (or zz) be an arbitrary oriented path from vv to yy (zz) in G1G_{1}. Now c0=f(v;c1,c2,,ck),f(v1;c11,c21,,ck1),,f(vt;c1t,c2t,,ckt),f(y;d1,d1,,d1)=d1c_{0}=f(v;c_{1},c_{2},\dots,c_{k}),f(v_{1};c^{1}_{1},c^{1}_{2},\dots,c^{1}_{k}),\dots,f(v_{t};c^{t}_{1},c^{t}_{2},\dots,c^{t}_{k}),f(y;d_{1},d_{1},\dots,d_{1})=d_{1} where c1i,c2i,,ckiL1(vi)c^{i}_{1},c^{i}_{2},\dots,c^{i}_{k}\in L_{1}(v_{i}), 1it1\leq i\leq t, implies a path from c0c_{0} to d1d_{1}, and hence, there exists an oriented path from c0c_{0} to d1d_{1} in L(P1)L(P_{1}) and congruent to P1P_{1}. This would mean c0L1(v)c_{0}\in L_{1}(v), according to Sym-Diff construction. Observe that G1G_{1} is an induced sub-digraph of GG, and xV(G1)|L1(x)|<xV(G)|L(x)|\sum_{x\in V(G_{1})}|L_{1}(x)|<\sum_{x\in V(G)}|L(x)|. Thus, by induction hypothesis (assuming Not-Minority returns the right answer on smaller instance) for instance G1,L1,H,fG_{1},L_{1},H,f, there is no homomorphism from G1G_{1} to HH that maps, yy to d1d_{1} and zz to e1e_{1}.

For contradiction, suppose there exists an LL-homomorphism gg from GG to HH (with g(y)=d1g(y)=d_{1}, g(z)=e1g(z)=e_{1}). Then, for every vertex vV(G1)v\in V(G_{1}) we have g(v)L(v)g(v)\in L(v), and (g(v),d1)L(v,y)(g(v),d_{1})\in L(v,y), and (g(v),e1)L(v,z)(g(v),e_{1})\in L(v,z). On the other hand, by the construction in function Sym-Diff, L1(v)L_{1}(v) contains every element iL(v)i\in L(v) when (i,d1)L(v,y)(i,d_{1})\in L(v,y) and (i,e1)L(v,z)(i,e_{1})\in L(v,z), and consequently g(v)L1(v)g(v)\in L_{1}(v). However, g1:G1Hg_{1}:G_{1}\rightarrow H, with g1(u)=g(u)g_{1}(u)=g(u) for every uV(G1)u\in V(G_{1}) is a homomorphism, a contradiction to nonexistence of such a homomrphism.

Notice that (d1,i)L(y,v)(d_{1},i)\in L(y,v) and (e1,i)L(z,v)(e_{1},i)\in L(z,v), in the first call to Sym-Diff. But, if at some earlier call to Sym-Diff, we removed (d1,i)(d_{1},i) from L(y,v)L(y,v) then by induction hypothesis this decision was a right decision, and hence, ig(v)i\neq g(v), and consequently is not used for gg.

Proof of (β\beta) is analogous to proof of (α)(\alpha).

Proof of (γ\gamma) Suppose test1,test2test_{1},test_{2} are true. Let g1g_{1} be the homomorphism returned by Not-Minority function for the instance G1,H,L1,fG_{1},H,L_{1},f, and g2g_{2} be the homomorphism returned by Not-Minority function for instance G2,H,L2,fG_{2},H,L_{2},f. (i.e. from Sym-Diff(G,L,y,d2,d1,z,e1G,L,y,d_{2},d_{1},z,e_{1})). By definition G1=G2G_{1}=G_{2}. Let GG^{\prime} be the digraph constructed in Sym-Diff(G,L,y,d,d1,z,e1G,L,y,d,d_{1},z,e_{1}). Notice that GG^{\prime} is an induced sub-digraph of G1G_{1}. This is because when z1z_{1} is in B(G1)B(G_{1}) then there exists some rL(v)r\in L(v) such that (d1,r),(d2,r)L(y,v)(d_{1},r),(d_{2},r)\in L(y,v), and since ff is closed under LL, we have (f(v,d1k,d2),r)L(y,v)(f(v,d_{1}^{k},d_{2}),r)\in L(y,v). Therefore, vv is either inside B(G)B(G^{\prime}) or vV(G)V(G)v\in V(G)\setminus V(G^{\prime}); meaning that GG^{\prime} does not expand beyond B(G1)B(G_{1}), and hence, GG^{\prime} is an induced sub-digraph of G1G_{1}.

Now for every vertex yV(G)y\in V(G^{\prime}), set g3(y)=f(y;g1k(y),g2(y))g_{3}(y)=f(y;g_{1}^{k}(y),g_{2}(y)). Since g1,g2g_{1},g_{2} are also LL-homomorphism from G1=G2G_{1}=G_{2} to HH and ff is a polymorphism, it is easy to see that g3g_{3} is an LL-homomorphism from G1G_{1} to HH, and hence, also an LL- homomorphism from GG^{\prime} to HH.

Proof of (λ\lambda) Suppose there exists an LL-homomorphism g:GHg:G\rightarrow H with g(y)=d1g(y)=d_{1}, g(z)=e1g(z)=e_{1}. Then we show that there exists an LL-homomorphism h:GHh:G\rightarrow H with h(y)=dh(y)=d, h(z)=e1h(z)=e_{1}.

Remark: The structure of the proof is as follows. In order to prove the statement of the Lemma 4.3(λ\lambda) we use Claim 4.4. The proof of Claim 4.4 is based on the induction on the size of the lists.

Let g1g_{1} be an LL-homomorphism from G1G_{1} to HH with g1(y)=d1g_{1}(y)=d_{1} and g1(z)=e1g_{1}(z)=e_{1}, and g2g_{2} be an LL-homomorphism from G2G_{2} to HH with g2(y)=d2g_{2}(y)=d_{2}, and g2(z)=e1g_{2}(z)=e_{1}. According to γ\gamma, there exists an LL-homomorphism g3=gd,e1y,zg_{3}=g^{y,z}_{d,e_{1}} form G=G1=G2G^{\prime}=G_{1}=G_{2} to HH, that maps yy to dd and zz to e1e_{1}. As argued in the proof of γ\gamma, g3g_{3} is constructed based on g1,g2g_{1},g_{2} and polymorphism ff. We also assume that g1g_{1} agrees with gg in G1G_{1}.

If G=GG^{\prime}=G, then we return the homomorphism g3g_{3} as the desired homomorphism. Otherwise, consider a vertex z1z_{1} which is on the boundary of GG^{\prime}, B(G)B(G^{\prime}). Recall that B(G)B(G^{\prime}) is the set of vertices uV(G)u\in V(G) with some iLz,e1(u)i\in L_{z,e_{1}}(u), such that (i,d1),(i,d2)Lz,e1(u,y)(i,d_{1}),(i,d_{2})\in L_{z,e_{1}}(u,y). Let PP be an oriented path in GB(G)G^{\prime}\cup B(G^{\prime}) from yy to zz, and let P1P_{1} be an oriented path in GB(G)G^{\prime}\cup B(G^{\prime}) from yy to z1z_{1}. We may assume PP and P1P_{1} meet at some vertex vv (vv could be yy, see Figure 9). We may assume z1z_{1} is chosen such that 1=g(z1)\ell_{1}=g(z_{1}), and g3(v1)1A(H)g_{3}(v_{1})\ell_{1}\not\in A(H) (1g3(v1)A(H)\ell_{1}g_{3}(v_{1})\not\in A(H)) where v1v_{1} is last vertex before z1z_{1} on P1P_{1}, and v1z1A(G)v_{1}z_{1}\in A(G) (z1v1A(G)z_{1}v_{1}\in A(G)) (g3(v1)g_{3}(v_{1}) must have a neighbor inside L(z1)L(z_{1}) because of the Preprocessing). Notice that if g3(v1)1A(G)g_{3}(v_{1})\ell_{1}\in A(G) for every such path P1P_{1} then we can extend g3g_{3} to z1z_{1} as well. Moreover, if there is no such z1z_{1} then we can extend g3g_{3} to B(G)B(G^{\prime}), and define h(y)=g3(y)h(y)=g_{3}(y) for every yV(G)y\in V(G^{\prime}), and h(y)=g(y)h(y)=g(y) for every yV(G)V(G)y\in V(G)\setminus V(G^{\prime}). It is easy to see that hh is an L-homomorphism from GG to HH with h(y)=dh(y)=d. Thus, we proceed by assuming the existence of such z1z_{1}. Let L1=Ly,d1,z,e1L_{1}=L_{y,d_{1},z,e_{1}}, and L2=Ly,d2,z,e1L_{2}=L_{y,d_{2},z,e_{1}}. Now we look at GG^{\prime}, and the aim is the following.

  • First, modify gg on the boundary vertices, B(G)B(G^{\prime}), so that the image of every ziB(G)z_{i}\in B(G^{\prime}), g(zi)Ly,d,z,e1(zi)g(z_{i})\in L_{y,d,z,e_{1}}(z_{i}), i.e. (d,g(zi))L(y,zi)(d,g(z_{i}))\in L(y,z_{i}).

  • Second, having a homomorphism g3g_{3} (i.e. g3(y)=dg_{3}(y)=d, g3(z)=e1g_{3}(z)=e_{1}) from GB(G)G^{\prime}\cup B(G^{\prime}) to HH that agrees with gg on B(G)B(G^{\prime}).

Maybe the second goal is not possible on B(G)B(G^{\prime}), and hence, we look beyond B(G)B(G^{\prime}) and look for differences between g3g_{3} and gg inside an induced sub-digraph of GG containing GG^{\prime}. We construct the next part of homomorphism hh using g3g_{3} and homomrphism g3g^{\prime}_{3} ( obtained from gg, gi,e1zi,zg^{z_{i},z}_{\ell_{i},e_{1}} for some iL(zi)\ell_{i}\in L(z_{i})), and homomorphism ff.

Refer to caption
Figure 9: z1B(G)z_{1}\in B(G^{\prime}), and 1,1Lz,e1(z1)\ell_{1},\ell^{\prime}_{1}\in L_{z,e_{1}}(z_{1}), (b2,1)Lz,e1,y,d1(v,z1)(b_{2},\ell^{\prime}_{1})\in L_{z,e_{1},y,d_{1}}(v,z_{1}), . Thus, there is a walk from b=f(v;b2k,b1)b=f(v;b_{2}^{k},b_{1}) to e2=f(z1;1k,1)e_{2}=f(z_{1};\ell_{1}^{\prime k},\ell_{1}) in L(P1[v,z1])L(P_{1}[v,z_{1}])

Let b1=g(v)b_{1}=g(v) and let b2=g2(v)b_{2}=g_{2}(v), and b=f(v;b2k,b1)b=f(v;b_{2}^{k},b_{1}). Let 1=g(z1)\ell_{1}=g(z_{1}), and 1L(z1)\ell^{\prime}_{1}\in L(z_{1}) such that g2(v1)1A(H)g_{2}(v_{1})\ell^{\prime}_{1}\in A(H) (recall that v1z1v_{1}z_{1} is the last arc on P1P_{1}; the path from yy to zz).

First scenario. There exists 1L1(z1)L2(z1)\ell^{\prime}_{1}\in L_{1}(z_{1})\cap L_{2}(z_{1}) such that (b1,1),(b2,1)L(v,z1)(b_{1},\ell^{\prime}_{1}),(b_{2},\ell^{\prime}_{1})\in L(v,z_{1}) (see Figure 9). Note that since gg is a homomorphism, we have (d1,b1)L(y,v)(d_{1},b_{1})\in L(y,v) and (b1,e1)L(v,z)(b_{1},e_{1})\in L(v,z). Set e2=f(z1;(1)k,1).e_{2}=f(z_{1};(\ell^{\prime}_{1})^{k},\ell_{1}).

Case 1. Suppose e21e_{2}\neq\ell_{1}. Let P1[v,z1]=v,v1,v2,,vt,z1P_{1}[v,z_{1}]=v,v_{1},v_{2},\dots,v_{t},z_{1}, and let walk b2,c1,c2,,ct,1b_{2},c_{1},c_{2},\dots,c_{t},\ell^{\prime}_{1}, and walk b1,d1,,dt,1b_{1},d_{1},\dots,d_{t},\ell_{1} be inside L(P1[v,z1])L(P_{1}[v,z_{1}]) and congruent with it. Observe that the walk f(v,b2k,b1),f(v1,c1k,d1),,f(vt,ctk,dt),f(z1,(1)k,1)f(v,b_{2}^{k},b_{1}),f(v_{1},c_{1}^{k},d_{1}),\dots,f(v_{t},c_{t}^{k},d_{t}),f(z_{1},(\ell^{\prime}_{1})^{k},\ell_{1}) inside L(P1[v,z1])L(P_{1}[v,z_{1}]) is from b=f(v,b2k,b1)b=f(v,b_{2}^{k},b_{1}) to e2e_{2}. Therefore, (b,e2)L(v,z1)(b,e_{2})\in L(v,z_{1}) (Figure 9), and consequently (d,e2)L(y,z1)(d,e_{2})\in L(y,z_{1}).

Case 2. Suppose e2=1e_{2}=\ell_{1}. Note that in this case again by following the oriented path P1[v,z1]P_{1}[v,z_{1}] and applying the polymorphism ff in L(P1)L(P_{1}), we conclude that there exists a walk from bb to e2e_{2} in L(P1[v,z1])L(P_{1}[v,z_{1}]), congruent to P1[v,z1]P_{1}[v,z_{1}], and hence, (b,1)L(v,z1)(b,\ell_{1})\in L(v,z_{1}) and consequently (d,e2)L(y,z1)(d,e_{2})\in L(y,z_{1})

Since G,L1G,L_{1} is smaller than the original instance, by Claim 4.4, the small tests pass for G,L1G,L_{1}, and hence, by induction hypothesis, we may assume that there exists another L1L_{1}-homomorphism from GG to HH that maps yy to d1d_{1} and zz to e1e_{1}, and z1z_{1} to e2e_{2}. Thus, for the sake of less notations we may assume gg is such a homomorphism. This means we may reduce the lists L1L_{1} by identifying 1\ell_{1} and e2e_{2} when e21e_{2}\neq\ell_{1} in L1(z1)L_{1}(z_{1}), and hence, we restrict the lists L1L_{1} to L1(z1,e2)L_{1}(z_{1},e_{2}). Observe that according to Cases 1,2, (d,e2)L(y,z1)(d,e_{2})\in L(y,z_{1}).

We continue this procedure as follows: Let z2z_{2} be the next vertex in B(G)B(G^{\prime}) with g(z2)=2g(z_{2})=\ell_{2}. Again if the First scenario occurs, meaning that there exists 2L2(z2)\ell^{\prime}_{2}\in L_{2}(z_{2}) such that (b2,2)L(v,z2)(b_{2},\ell^{\prime}_{2})\in L(v,z_{2}) and (b1,2)L1(v,z2)(b_{1},\ell^{\prime}_{2})\in L_{1}(v,z_{2}) then we continue as follows. Let e3=f(z2;(2)k,2)e_{3}=f(z_{2};(\ell^{\prime}_{2})^{k},\ell_{2}) (see Figure 10).

Refer to caption
Figure 10: z2B(G)z_{2}\in B(G^{\prime}), and 2,2Lz,e1(z2)\ell_{2},\ell^{\prime}_{2}\in L_{z,e_{1}}(z_{2}) where 2=g(z2)\ell_{2}=g(z_{2}). There is a walk from bb to e3=f(z2;(2)k,2)e_{3}=f(z_{2};(\ell^{\prime}_{2})^{k},\ell_{2})

If e3=2e_{3}=\ell_{2} then we have (b,2)L1(v,z2)(b,\ell_{2})\in L_{1}(v,z_{2}) (this is because of the definition of the polymorphism ff), and hence, as in Case 2 we don’t modify gg. Otherwise, we proceed as in Case 1. In other words, we may assume that there exists an L1L_{1}-homomorphism from GG to HH that maps y1y_{1} to d1d_{1}, zz to e1e_{1} and z1z_{1} to e2e_{2}, and z2z_{2} to e3e_{3}. We may assume gg is such a homomorphism. Again this means we further restrict gg on the boundary vertices of GG^{\prime}; B(G)B(G^{\prime}), so they are simultaneously reachable from bb. If all the vertices in B(G)B(G^{\prime}) fit into the First scenario then we return homomorphism hh from GG to HH where inside GG^{\prime}, hh agrees with g3g_{3} and outside GG^{\prime}, hh agrees with gg. Otherwise, we go on to the Second scenario.

Second scenario. There is no 1L1(z1)L2(z1)\ell^{\prime}_{1}\in L_{1}(z_{1})\cap L_{2}(z_{1}) such that (b1,1),(b2,1)L(v,z1)(b_{1},\ell^{\prime}_{1}),(b_{2},\ell^{\prime}_{1})\in L(v,z_{1}) (see Figure 11). At this point we need to start from vertex v,b1,b2,bL(v)v,b_{1},b_{2},b\in L(v). We consider the digraph (G2,L2)=(G^{2},L^{2})= Sym-Diff(G,L2,v,b1,b2,z,e1G,L_{2},v,b_{1},b_{2},z,e_{1}) and follow homomrphism gg inside G2G^{2}, by considering B(G2)B(G^{2}), and further modifying gg so that its images are reachable from bb simultaneously. For example, let 1=g(z1)\ell_{1}=g(z_{1}), 1L(z1)\ell^{\prime}_{1}\in L(z_{1}) with g2(v1)1A(H)g_{2}(v_{1})\ell^{\prime}_{1}\in A(H), where v1z1v_{1}z_{1} is the last arc of P1P_{1}, and bL(z1)b^{\prime}\in L(z_{1}) with b=f(z1;(1)k,1)b^{\prime}=f(z_{1};(\ell^{\prime}_{1})^{k},\ell_{1}). Notice that here we may g2g_{2} is an L2L_{2}-homomorphism obtained by calling Not-Minority(G2,H,L2,fG_{2},H,L_{2},f). This homomorphism should exist because of Claim 4.4 for L2L_{2}.

Refer to caption
Figure 11: z1B(G)z_{1}\in B(G^{\prime}), and 1,1Lz,e1(z1)\ell_{1},\ell^{\prime}_{1}\in L_{z,e_{1}}(z_{1}). There is a walk from bb to b=f(z1;(1)k,1)b^{\prime}=f(z_{1};(\ell^{\prime}_{1})^{k},\ell_{1})

Now as depicted in Figure 11, let w1w_{1} be a vertex in B(G2)B(G^{2}), and suppose there exists a1L2(w1)L1(w1)a^{\prime}_{1}\in L_{2}(w_{1})\cap L_{1}(w_{1}) such that (1,a1)L1(z1,w1)(\ell_{1},a^{\prime}_{1})\in L_{1}(z_{1},w_{1}) and (1,a1)L2(z1,w1)(\ell^{\prime}_{1},a^{\prime}_{1})\in L_{2}(z_{1},w_{1}). Let a1=g(w1)a_{1}=g(w_{1}). Now as in Case 1,2, we conclude that there exists a path from bb^{\prime} to a2=f(w1;(a1)k,a1)a_{2}=f(w_{1};(a^{\prime}_{1})^{k},a_{1}), and hence, we can further modify gg so that its image on w1w_{1} is a2a_{2}. If there is no such a1a^{\prime}_{1} then we will be back in the Second scenario.

This process goes on as long as for all the boundary vertices the first scenario occur or we may reach to entire GG. In any case, we would have a homomorphism that maps yy to dd and zz to e1e_{1}.

Claim 4.4

Suppose all the small tests pass for instance (G,L,H)(G,L,H). Let x1x_{1} be an arbitrary vertex of GG and let c1L(x1)c_{1}\in L(x_{1}). Let L1=Lx1,c1L_{1}=L_{x_{1},c_{1}}. Then all the small tests pass for G,L1G,L_{1}.

Proof: Let G1G_{1} be the sub-digraph constructed in Sym-Diff(G,L,y,d1,d2,x1,c1G,L,y,d_{1},d_{2},x_{1},c_{1}). Note that there exists, an L1L_{1}-homomorphism, g1:G1Hg_{1}:G_{1}\rightarrow H with g1(x1)=c1g_{1}(x_{1})=c_{1}, g1(y)=d1g_{1}(y)=d_{1}. Let L2=(L1)y,d1L_{2}=(L_{1})_{y,d_{1}}, and let L3=(L2)x2,c2L_{3}=(L_{2})_{x_{2},c_{2}}. The goal is to build a homomorphism ψ\psi, piece by piece, that maps x1x_{1} to c1c_{1}, x2x_{2} to c2c_{2}, and yy to d1d_{1} where its image lies in L3L_{3}. In order to to that we use induction on the size of z1V(G1)|L3(z1)|\sum_{z_{1}\in V(G_{1})}|L_{3}(z_{1})|. First suppose there exists x3x_{3} on the oriented path from x2x_{2} to yy, and let a1,a2L2(x3)a_{1},a_{2}\in L_{2}(x_{3}) so that any oriented path from a1L1(x3)a_{1}\in L_{1}(x_{3}) inside L1(Y[x3,x2])L_{1}(Y[x_{3},x_{2}]) ends at c2c_{2}. Since d1d2d_{1}\neq d_{2}, it is easy to assume that a1a2a_{1}\neq a_{2}. Now consider the sub-digraph, G2G_{2} constructed in Sym-Diff(G,L1,x3,a1,a2,x1,c1G,L_{1},x_{3},a_{1},a_{2},x_{1},c_{1}) ( a1,a2L2(x3)a_{1},a_{2}\in L_{2}(x_{3})) and let g2g_{2} be a homomorphism from G2G_{2} to HH. We may assume g2(y)=d1d1g_{2}(y)=d^{\prime}_{1}\neq d_{1} (see Figure 12). The other case; d1=d1d^{\prime}_{1}=d_{1}, is a special case of d1d1d_{1}^{\prime}\neq d_{1}.

Refer to caption
Figure 12: Proof of Claim 4.4

Notice that by the choice of x3x_{3}, g2(x2)=c2g_{2}(x_{2})=c_{2}. Thus, (c2,d1)L1(x2,y)(c_{2},d^{\prime}_{1})\in L_{1}(x_{2},y). Let L2=(L1)x2,c2,x3,a1L^{\prime}_{2}=(L_{1})_{x_{2},c_{2},x_{3},a_{1}} and notice that d1L2(y)d_{1}\in L^{\prime}_{2}(y). The total size of all the lists of L2L^{\prime}_{2} is less than the total size of the lists in L1L_{1} because L(x3)={a1}L^{\prime}(x_{3})=\{a_{1}\}. Thus, by induction hypothesis for the lists L2L^{\prime}_{2} we may assume that all the tests inside L2L^{\prime}_{2} pass, and hence, there exists an L2L^{\prime}_{2}, homomorphism g2g^{\prime}_{2} from G2G^{\prime}_{2} to HH, in which g2(y)=d1g^{\prime}_{2}(y)=d_{1}. Here G2G^{\prime}_{2} is the sub-digraph constructed in Sym-Diff(G,L1,y,d1,d1,x3,a1G,L_{1},y,d_{1},d^{\prime}_{1},x_{3},a_{1}). Notice that x3x_{3} is in B(G2)B(G^{\prime}_{2}).

Case 1. There exists a vertex of z1B(G2)V(G2)z_{1}\in B(G_{2})\cap V(G^{\prime}_{2}) (see Figure 12). In this case, the homomorphism ψ\psi agrees with g2g^{\prime}_{2} on the path ZZ from yy to zB(G2)z\in B(G^{\prime}_{2}) (where zz is also a vertex in B(G1)B(G_{1})) that goes through vertex z1z_{1}.

Refer to caption
Figure 13: The homomorphism on G2G^{\prime}_{2} shown by green color

Case 2. There exists a vertex of z1B(G2)z_{1}\in B(G^{\prime}_{2}), z1V(G2)B(G2)z_{1}\in V(G_{2})\setminus B(G_{2}) (see Figure 13). Let g2(z1)=b1g^{\prime}_{2}(z_{1})=b_{1}. Let b2(L1)x,c2,y,d2(z1)b_{2}\in(L_{1})_{x,c_{2},y,d_{2}}(z_{1}). Now we consider the sub-digraph G3G_{3} constructed in Sym-Diff(G,L1,z1,b1,b2,z,e1G,L_{1},z_{1},b_{1},b_{2},z,e_{1}) where zz is a vertex in B(G1)B(G_{1}). There exists, a homomorphism g3g_{3} from G3G_{3} to HH. We need to obtain g3g^{\prime}_{3} (using g3g_{3} and induction hypothesis) so that its image on some part of G1(G3G2)G_{1}\cap(G_{3}\cap G_{2}) lies inside L3L_{3}, and then ψ\psi would follow g3g^{\prime}_{3} on that part. To do so, we end with one of the cases 1, 2. If case 2 occurs we need to continue considering other partial homomorphisms.

Now consider the case where x3x_{3} does not exist, in other words, x3x_{3} is a vertex neighbor to x2x_{2}, and consider a1L3(x3)a_{1}\in L_{3}(x_{3}). In this case c2c_{2} is adjacent to a1a_{1}, and we can extend the homomorphism g2g_{2} to vertex x2x_{2} where g2(x2)=c2g_{2}(x_{2})=c_{2}. \diamond

Lemma 4.5

The running time of the algorithm is 𝒪(|G|4|H|k+4)\mathcal{O}(|G|^{4}|H|^{k+4}) (here |G||G| is the number of arcs plus the number of vertices of GG).

Proof: At the first glance, the algorithm 2 looks exponential because we make polynomially many recursive calls. However, it is easy to see that the depth of the recursion is at most |H||H|. This is based according to the construction of (G,L)=(G^{\prime},L^{\prime})=Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}); for each vV(G)v\in V(G^{\prime}), |L(v)|<|L(v)||L^{\prime}(v)|<|L(v)|. This simply would guarantee that the running time of the algorithm is of |G|𝒪(|H|)|G|^{\mathcal{O}(|H|)}.

However, it is more than just that, as the list becomes disjoint. Our implementation of algorithm would also support that the algorithm would perform much faster than |G|𝒪(|H|)|G|^{\mathcal{O}(|H|)}.

According to Observation 2.5, we consider each connected component of G×LHG\times_{L}H separately. The connected component partitioned the G×LHG\times_{L}H, and hence, the overall running time would be the sum of the running time of each connected components. We go through all the pairs and look for not-minority ones, which takes 𝒪(|G||H|k)\mathcal{O}(|G||H|^{k}) because we search for each kk-tuple inside the list of each vertex vv of GG. We also observe that the running time of the Preprocessing is 𝒪(|G|3|H|3)\mathcal{O}(|G|^{3}|H|^{3}). Note that at the end, we need to apply RemoveMinority algorithm which we assume there exists one with running time 𝒪(|G|3|H|3)\mathcal{O}(|G|^{3}|H|^{3}) (see [10]).

Now suppose Algorithm 2 starts calling function Sym-Diff where it considers two distinct vertices y,zV(G)y,z\in V(G) and e1L(z)e_{1}\in L(z), d1,d2L(y)d_{1},d_{2}\in L(y). The constructed instances are T1=(G1,L1)=T_{1}=(G_{1},L_{1})=Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1}) and T2=(G2,L2)=T_{2}=(G_{2},L_{2})=Sym-Diff(G,L,y,d2,d1,z,e1)G,L,y,d_{2},d_{1},z,e_{1}). The lists L1,L2L_{1},L_{2} (respectively) are disjoint because we exclude the boundary vertices into G1,G2G_{1},G_{2}. Therefore, the running time of T1T_{1} (T2T_{2}) is a polynomial of 𝒪(poly1(|G1|)poly2(|L1|))\mathcal{O}(poly_{1}(|G_{1}|)*poly_{2}(|L_{1}|)) (𝒪(poly1(|G2|)poly2(|L2|)\mathcal{O}(poly_{1}(|G_{2}|)*poly_{2}(|L_{2}|)) then the overall running time would be 𝒪(poly1(|G|)poly2(|L|))\mathcal{O}(poly_{1}(|G|)*poly_{2}(|L|)) for GG and LL. Here |L||L| denote the maximum size of a list and notice that |L||V(H)||L|\leq|V(H)|.

Let e1,e2,,etL(z)e_{1},e_{2},\dots,e_{t}\in L(z) and d1,d2,,drL(y)d_{1},d_{2},\dots,d_{r}\in L(y) such that they induce a bi-clique in LL. We may assume there exists at least one pair d1,d2d_{1},d_{2} which is not minority. According to function Bi-Clique-Instances instead of (d1,e1)(d_{1},e_{1}) we use only (d,e1)(d,e_{1}) where d=f(y;d2k,d1)d=f(y;d_{2}^{k},d_{1}) and continue making the pair lists L×LL\times L smaller. Eventually each Bi-clique turns to a single path or the instance becomes Minority instance. Therefore, this step of the algorithm is a polynomial process with a overall running time 𝒪(|G|2|H|k+1)\mathcal{O}(|G|^{2}|H|^{k+1}) because we need to consider each pair of vertices of GG and find a bi-clique. This means the degree of the poly1poly_{1} is three and the degree of poly2poly_{2} is k+1k+1 (we have of order |G|3|G|^{3} from Preprocessing or from RemoveMinority algorithm, and of order |H|k+1|H|^{k+1} for finding bi-cliques). Therefore, the entire algorithm runs in 𝒪(|G|4|H|k+4)\mathcal{O}(|G|^{4}|H|^{k+4}). This is because we consider every pair x,yx,y, and d1,d2L(y)d_{1},d_{2}\in L(y), and e1L(z)e_{1}\in L(z). \diamond

5 Weak near unanimity recognition algorithm

Let AA be a finite set. By a kk-ary relation RR on set AA we mean a subset of the kk-th cartesian power AkA^{k}; kk is said to be the arity of the relation. A constraint language (relational structure) Γ\Gamma over AA is a set of relations over AA. A constraint language is finite if it contains finitely many relations.

A hypergraph 𝒢\mathcal{G} on set XX, consists of a set of hyperedges where each hyperedge ee is an ordered tuple (x1,x2,,xk)(x_{1},x_{2},\dots,x_{k}) , x1,x2,,xkXx_{1},x_{2},\dots,x_{k}\in X. Here kk is called the size of the hyperedge ee. Notice that different hyperedges could have different sizes. A hypergraph is called uniform if all its hyperedges have the same size. We denote the vertices of the hypergraph 𝒢\mathcal{G} by V(𝒢)V(\mathcal{G}).

For two hypergraphs 𝒢,\mathcal{G},\mathcal{H}, a homomorphism f:𝒢f:\mathcal{G}\rightarrow\mathcal{H}, is a mapping from V(𝒢)V(\mathcal{G}) to V()V(\mathcal{H}) such that for every hyperedge (x1,x2,,xk)𝒢(x_{1},x_{2},\dots,x_{k})\in\mathcal{G}, (f(x1),f(x2),,f(xk))(f(x_{1}),f(x_{2}),\dots,f(x_{k})) is an hyperedge in \mathcal{H}.

An instance of the constraint satisfaction problem (CSP) can be viewed as an instance of the hypergraph list homomorphism problem. We are given two hypergraphs 𝒢,\mathcal{G},\mathcal{H} together with lists \mathcal{L} where each hyperedge α𝒢\alpha\in\mathcal{G} has a list of possible hyperedges (all with the same size as α\alpha) in \mathcal{H}, denoted by (α)\mathcal{L}(\alpha). The goal is to find a homomorphism f:𝒢f:\mathcal{G}\rightarrow\mathcal{H} such that for every hyperedge α=(x1,x2,,xk)𝒢\alpha=(x_{1},x_{2},\dots,x_{k})\in\mathcal{G}, (f(x1),f(x2),,f(xk))L(α)(f(x_{1}),f(x_{2}),\dots,f(x_{k}))\in L(\alpha). In other words, if we look at the vertices of 𝒢\mathcal{G} as variables, the vertices of \mathcal{H} as values, and hyperedges αs𝒢\alpha^{\prime}s\in\mathcal{G} as constraints then the existence of homomorphism ff illuminates a way of giving each variable a value, so that all constraints are satisfied simultaneously. A constraint is of form (α,L(α))(\alpha,L(\alpha)), and a constraint is satisfied if tuple α\alpha is mapped by ff into one of the tuples in its list.

Definition 5.1 (Signature)

For every two hyperedges α1,α2\alpha_{1},\alpha_{2} from 𝒢\mathcal{G} ( or \mathcal{H}) we associate a signature Sα1,α2={(i,j)| α1[i]=α2[j] }S_{\alpha_{1},\alpha_{2}}=\{(i,j)|\text{ $\alpha_{1}[i]=\alpha_{2}[j]$ }\} ( α1[i]\alpha_{1}[i] is the element in coordinate ii-th of α1\alpha_{1}).

Let \mathcal{H} be a hypergraph on set AA. Let 1,2,,t\mathcal{H}_{1},\mathcal{H}_{2},\dots,\mathcal{H}_{t} be a partition of \mathcal{H} into tt uniform hypergraphs. A mapping h:ArAh:A^{r}\rightarrow A is a polymorphism of arity rr on \mathcal{H} if hh is closed under each i\mathcal{H}_{i}, 1it1\leq i\leq t. In other words, for every rr hyperedges τ1,τ2,,τri\tau_{1},\tau_{2},\dots,\tau_{r}\in\mathcal{H}_{i}, h(τ1,τ2,,τr)ih(\tau_{1},\tau_{2},\dots,\tau_{r})\in\mathcal{H}_{i}. Notice that here hh is applied coordinate wise (e.g. if (a1,a2,a3),(b1,b2,b3),(c1,c2,c3)(a_{1},a_{2},a_{3}),(b_{1},b_{2},b_{3}),(c_{1},c_{2},c_{3}) are hyperedges in HiH_{i} then (h(a1,b1,c1),h(a2,b2,c2),h(a3,b3,c3))(h(a_{1},b_{1},c_{1}),h(a_{2},b_{2},c_{2}),h(a_{3},b_{3},c_{3})) is a hyperedge in HiH_{i}).

In order to prove Theorem 1.2 it is enough to prove the following theorem.

Theorem 5.2

Let \mathcal{H} be a hypergraph. Then the problem of deciding whether \mathcal{H} admits a weak NU polymorphism is polynomial time solvable.

The proof of the Theorem 5.2 consists of several lemmas and an algorithm as follows. Let 1,,t\mathcal{H}_{1},\dots,\mathcal{H}_{t} be a partitioned of \mathcal{H} into uniform hypergraphs. We construct graph G,HG,H and lists LL.

Vertices of G,HG,H and lists LL: The vertices of GG are four tuples x¯=(α,β,γ,λ)\overline{x}=(\alpha,\beta,\gamma,\lambda) where α,β,γ,λl\alpha,\beta,\gamma,\lambda\in\mathcal{H}_{l}, 1lt1\leq l\leq t. The vertices of HH are τ¯\overline{\tau} where τ\tau is a hyperedge of \mathcal{H}. For x¯=(α,β,γ,λ)\overline{x}=(\alpha,\beta,\gamma,\lambda), L(x¯)L(\overline{x}), consists of all τ¯\overline{\tau}, τl\tau\in\mathcal{H}_{l} with the following property:

  • If α[i]=β[j]=λ[i]\alpha[i]=\beta[j]=\lambda[i], α[j]=γ[j]=β[i]\alpha[j]=\gamma[j]=\beta[i], and γ[i]=λ[j]\gamma[i]=\lambda[j] then τ[i]=τ[j]\tau[i]=\tau[j].

Adjacency in GG : Two vertices x¯=(α,β,γ,λ)\overline{x}=(\alpha,\beta,\gamma,\lambda), and y¯=(α,β,γ,λ)\overline{y}=(\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}) from GG with α,β,γ,λl\alpha,\beta,\gamma,\lambda\in\mathcal{H}_{l}, α,β,γ,λl\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}\in\mathcal{H}_{l^{\prime}} are adjacent if at least one of the following occurs.

  • Sα,αSβ,βSγ,γSλ,λS_{\alpha,\alpha^{\prime}}\cap S_{\beta,\beta^{\prime}}\cap S_{\gamma,\gamma^{\prime}}\cap S_{\lambda,\lambda^{\prime}}\neq\emptyset.

  • α[i]=β[j]=λ[i]\alpha[i]=\beta^{\prime}[j]=\lambda[i], α[j]=γ[j]=β[i]\alpha^{\prime}[j]=\gamma^{\prime}[j]=\beta[i], and γ[i]=λ[j]\gamma[i]=\lambda^{\prime}[j]

Adjacency in HH: Two vertices τ¯L(x¯)\overline{\tau}\in L(\overline{x}) and ω¯L(y¯)\overline{\omega}\in L(\overline{y}) in HH where x¯=(α,β,γ,λ)\overline{x}=(\alpha,\beta,\gamma,\lambda), and y¯=(α,β,γ,λ)\overline{y}=(\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}) are adjacent if the following occurs :

  • Sα,αSβ,βSγ,γSλ,λSτ,ωS_{\alpha,\alpha^{\prime}}\cap S_{\beta,\beta^{\prime}}\cap S_{\gamma,\gamma^{\prime}}\cap S_{\lambda,\lambda^{\prime}}\subseteq S_{\tau,\omega}

  • If α[i]=β[j]=λ[i]\alpha[i]=\beta^{\prime}[j]=\lambda[i], α[j]=γ[j]=β[i]\alpha^{\prime}[j]=\gamma^{\prime}[j]=\beta[i], and γ[i]=λ[j]\gamma[i]=\lambda^{\prime}[j] then τ[i]=ω[j]\tau[i]=\omega[j].

Lemma 5.3

\mathcal{H} admits a Siggers polymorphism if and only if there is an LL-homomorphism from GG to HH.

Proof: Suppose \mathcal{H} admits a Siggers polymorphism ϕ\phi. For every vertex x¯=(α,β,γ,λ)G\overline{x}=(\alpha,\beta,\gamma,\lambda)\in G where α,β,γ,λl\alpha,\beta,\gamma,\lambda\in\mathcal{H}_{l}, define mapping g:GHg:G\rightarrow H with g(x¯)=ϕ(α,β,γ,λ)¯g(\overline{x})=\overline{\phi(\alpha,\beta,\gamma,\lambda)} , where ϕ\phi is applied coordinate wise. Let y¯=(α,β,γ,λ)\overline{y}=(\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}) and suppose x¯y¯\overline{x}\overline{y} is an edge of GG. By definition, τ¯L(x¯)\overline{\tau}\in L(\overline{x}) where τ=ϕ(α,β,γ,λ)\tau=\phi(\alpha,\beta,\gamma,\lambda) and ω¯L(y¯)\overline{\omega}\in L(\overline{y}) where ω=ϕ(α,β,γ,λ)\omega=\phi(\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}). Notice that if (i,j)Sα,α,Sβ,β,Sγ,γ(i,j)\in S_{\alpha,\alpha^{\prime}},S_{\beta,\beta^{\prime}},S_{\gamma,\gamma^{\prime}} then the value of ii-th coordinate of τ\tau is ϕ(a1,a2,a3,a4)\phi(a_{1},a_{2},a_{3},a_{4}) (a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} are the ii-th coordinates of α,β,γ,λ\alpha,\beta,\gamma,\lambda respectively) and the value of the jj-th coordinate of ω\omega is ϕ(a1,a2,a3,a4)\phi(a_{1},a_{2},a_{3},a_{4}) (a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} are the jj-th coordinate of α,β,γ,λ\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime} respectively). Therefore, (i,j)Sτ,ω(i,j)\in S_{\tau,\omega}, and hence, there is an edge from τ¯\overline{\tau} to ω¯\overline{\omega} in HH. Moreover, if x¯\overline{x}, y¯\overline{y} are adjacent because α[i]=β[j]=λ[i]\alpha[i]=\beta^{\prime}[j]=\lambda[i], α[j]=γ[j]=β[i]\alpha^{\prime}[j]=\gamma^{\prime}[j]=\beta[i] then by definition τ[i]=ω[j]\tau[i]=\omega[j] and, and hence, τ¯,ω¯\overline{\tau},\overline{\omega} are adjacent in HH. Therefore, gg is a homomorphism from GG to HH.

Conversely, suppose gg is an LL-homomorphism from GG to HH. Suppose τ¯=g(x¯)\overline{\tau}=g(\overline{x}) for x=(α,β,γ,λ)x=(\alpha,\beta,\gamma,\lambda). Then, for every a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} that are the ii-th coordinate of α,β,γ,λ\alpha,\beta,\gamma,\lambda, respectively, set ϕ(a1,a2,a3,a4)=a5\phi(a_{1},a_{2},a_{3},a_{4})=a_{5} where a5a_{5} is the ii-th coordinate of τ\tau (recall τ\tau is a ordered hyperedge corresponding to τ¯=g(x¯)\overline{\tau}=g(\overline{x})).

Consider a vertex y¯G\overline{y}\in G with y¯=(α,β,γ,λ)\overline{y}=(\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime}). Suppose the jj-coordinate of α,β,γ,λ\alpha^{\prime},\beta^{\prime},\gamma^{\prime},\lambda^{\prime} are a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} respectively. Let ω¯=g(y¯)\overline{\omega}=g(\overline{y}). By definition, ϕ(a1,a2,a3,a4)\phi(a_{1},a_{2},a_{3},a_{4}) is a5a^{\prime}_{5} where a5a^{\prime}_{5} is the jj-th coordinate of ω\omega. We show that a5=a5a_{5}=a^{\prime}_{5}. Observe that (i,j)Sα,αSβ,βSγ,γSλ,λ(i,j)\in S_{\alpha,\alpha^{\prime}}\cap S_{\beta,\beta^{\prime}}\cap S_{\gamma,\gamma^{\prime}}\cap S_{\lambda,\lambda^{\prime}} where a1a_{1} appears in ii-th coordinate of α\alpha and in the jj-th coordinate of α\alpha^{\prime}; a2a_{2} is an element appearing in ii-th coordinate of β\beta and in the jj-th coordinate of β\beta^{\prime}; a3a_{3} appears in the ii-th coordinate of γ\gamma and in the jj-th coordinate of γ\gamma^{\prime}; and finally a4a_{4} appears in the ii-th coordinate of λ\lambda and in the jj-th coordinate of λ\lambda^{\prime}. Therefore, x¯,y¯\overline{x},\overline{y} are adjacent in GG, and since gg is a homomorphism, τ¯\overline{\tau} and ω¯\overline{\omega} must be adjacent in HH. By the construction of the lists, the ii-th coordinate of τ\tau is the same as the jj-th coordinate of ω\omega, i.e. a5=a5a_{5}=a^{\prime}_{5}. Notice that since gg is a list homomorphism, τ¯L(x¯)\overline{\tau}\in L(\overline{x}) where τ=h(α,β,γ,λ)\tau=h(\alpha,\beta,\gamma,\lambda), and hence, τ\tau belongs to \mathcal{H}. \diamond

Lemma 5.4

If \mathcal{H} admits a Siggers polymorphism then G×LH4G\times_{L}H^{4} admits a Siggers list polymorphism.

Lemma 5.5

If \mathcal{H} admits a Siggers polymorphism then it also admits a weak kk-NU for some kk and G×LHkG\times_{L}H^{k} admits a weak kk-NU list polymorphism.

Proof: It has been shown by Siggers [47] that if \mathcal{H} admits a Sigger polymorphism it is also admit a weak NU of arity kk for some k3k\geq 3. It is easy to see that G×LHkG\times_{L}H^{k} admits a weak NU list polymorphis when \mathcal{H} admits a weak kk-NU. \diamond

Recall that for a,bL(x)a,b\in L(x), we say (a,b)(a,b) (with respect to xx) is a minority pair if f(x;ak,b)=bf(x;a^{k},b)=b, otherwise, we call (a,b)(a,b) a non-minority pair.

Lemma 5.6

Let xGx\in G, a,bL(x)a,b\in L(x). Suppose there exists yGy\in G, c,dL(y)c,d\in L(y) such that (a,c),(a,d)L(x,y)(a,c),(a,d)\in L(x,y) and (b,d)L(x,y)(b,d)\in L(x,y) but (b,c)L(x,y)(b,c)\not\in L(x,y). Then at least one of the (d,c)(d,c), (a,b)(a,b) is not a minority pair.

Proof: By contradiction suppose, f(y;dk,c)=cf(y;d^{k},c)=c. Now by applying the polymorphism ff on the L(Y)L(Y), where YY is a path from xx to yy, we conclude that f(x;b,ak)bf(x;b,a^{k})\neq b (because (c,b)L(x,y)(c,b)\not\in L(x,y)), and hence, f(x;ak,b)bf(x;a^{k},b)\neq b. \diamond

5.1 Algorithm for weak NU polymorphisms

Removing non-minority pairs

Algorithm 3 performs a test (with respect to y,zGy,z\in G and d1,d2L(y)d_{1},d_{2}\in L(y), e1L(z)e_{1}\in L(z)) on a sub-digraph GG^{\prime} with the lists LL^{\prime} which are constructed this way. Let L1=Lz,e1L_{1}=L_{z,e_{1}}. First GG^{\prime} includes vertices vv of GG such that for every (d1,j)L1(y,v)(d_{1},j)\in L_{1}(y,v) we have (d2,j)L1(y,v)(d_{2},j)\not\in L_{1}(y,v). Next, we further prune the lists LL^{\prime} as follows; for each vGv\in G^{\prime}, L(v)={i(d1,i)L1(y,v)}L^{\prime}(v)=\{i\mid(d_{1},i)\in L_{1}(y,v)\}. We ask whether there exists an LL^{\prime}-homomorphism from GG^{\prime} to HH. If there is no such homomorphism then we remove (d1,e1)(d_{1},e_{1}) from the pair list (y,z)(y,z).

Algorithm 3 Finding a homomorphism from GG to HH
1:Input: G,HG,H, lists LL
2:function Weak-NU(G,H,LG,H,L)
3:     if  \forall xV(G)x\in V(G), |L(x)|1|L(x)|\leq 1  then \forall xV(G)x\in V(G) set g(x)=L(x)g(x)=L(x)
4:         return gg \triangleright gg is a homomorphism from GG to HH      
5:     If G×LHG\times_{L}H is not connected then consider each connected component separately
6:     for all y,zV(G)y,z\in V(G), d1,d2L(y)d_{1},d_{2}\in L(y), e1L(z)e_{1}\in L(z) s.t. (d1,e1),(d2,e1)L(y,z)(d_{1},e_{1}),(d_{2},e_{1})\in L(y,z)  do
7:         (G,L)=(G^{\prime},L^{\prime})=Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1})
8:         gd1,e1y,z=g^{y,z}_{d_{1},e_{1}}= Weak-NU(G,H,LG^{\prime},H,L^{\prime})
9:         if  gd1,e1y,zg^{y,z}_{d_{1},e_{1}} is empty  then
10:              Remove (d1,e1)(d_{1},e_{1}) from L(y,z)L(y,z), and remove (e1,d1)(e_{1},d_{1}) from L(z,y)L(z,y)               
11:     g=g=Getting-to-Minortiy(G,H,LG,H,L)
12:     return gg \triangleright gg is a homomorphism from GG to HH
1:Input: Digraphs GG, lists LL and, y,zV(G)y,z\in V(G), d1,d2L(y)d_{1},d_{2}\in L(y), e1L(z)e_{1}\in L(z)
2:function Sym-Diff(G,L,y,d1,d2,z,e1G,L,y,d_{1},d_{2},z,e_{1})
3:     Create new lists LL^{\prime} and let L1=Lz,e1L_{1}=L_{z,e_{1}}, and construct the pair lists L1×L1L_{1}\times L_{1} from L1L_{1}
4:     Set L(z)=e1L^{\prime}(z)=e_{1}, L(y)=d1L^{\prime}(y)=d_{1}, and set G=G^{\prime}=\emptyset
5:     for all  vV(G)v\in V(G) s.t. i\forall i with (i,d1)L1(v,y)(i,d_{1})\in L_{1}(v,y) we have (i,d2)L1(v,y)(i,d_{2})\not\in L_{1}(v,y)  do
6:         add vv^{\prime} into set GG^{\prime}      
7:     Let GG^{\prime} be the induced sub-digraph of GG
8:     for all uV(G)u\in V(G^{\prime}) do
9:         L(u)={i(d1,i)L1(y,u)}L^{\prime}(u)=\{\text{$i\mid(d_{1},i)\in L_{1}(y,u)$}\}      
10:     for all  u,vV(G)u,v\in V(G^{\prime})  do
11:         L(u,v)={(a,b)L1(u,v)|(a,b)isconsistentinG}L^{\prime}(u,v)=\{(a,b)\in L_{1}(u,v)|(a,b)\ \ is\ \ consistent\ \ in\ \ G^{\prime}\}.      
12:     return (G,L)(G^{\prime},L^{\prime})

Getting into minority pairs

For xGx\in G and a,bL(x)a,b\in L(x), let Ga,bL,xG^{L,x}_{a,b} be the set of vertices yGy\in G such that for every iL(y)i\in L(y), (a,i)L(x,y)(a,i)\in L(x,y) and (b,i)L(x,y)(b,i)\not\in L(x,y). Let B(Ga,bL,x)B(G^{L,x}_{a,b}) be the vertices of GG outside Ga,bL,xG^{L,x}_{a,b} that are adjacent (via out-going, in-going arc) to a vertex in Ga,bxG^{x}_{a,b}.

Making Rectangles

Suppose for a,bL(x)a,b\in L(x), both (a,b),(b,a)(a,b),(b,a) are minority pairs. We look at every vertex yB(Ga,bL,x)y\in B(G^{L,x}_{a,b}) and two vertices c1,c2L(y)c_{1},c_{2}\in L(y). Suppose (a,c1),(a,c2),(b,c2)L(x,y)(a,c_{1}),(a,c_{2}),(b,c_{2})\in L(x,y). Now by Lemma 5.6 if (b,c1)L(x,y)(b,c_{1})\not\in L(x,y) then (c1,c2)(c_{1},c_{2}) is not a minority pair and according to Algorithm 2 (proof of correctness Lemma 4.3 (λ\lambda)) we can remove, (a,c1)(a,c_{1}) from L(x,y)L(x,y). Therefore, as long as there exist such yy and c1,c2L(y)c_{1},c_{2}\in L(y) we continue doing so. At the end, we end up with an instance Ga,bL,xB(Ga,bL,x)G^{L,x}_{a,b}\cup B(G^{L,x}_{a,b}) in which the rectangle property preserved for xGx\in G and a,bL(x)a,b\in L(x) and any yB(Ga,bL,x)y\in B(G^{L,x}_{a,b}) and c,dL(y)c,d\in L(y). In other words, if (a,c),(b,c),(a,d)L(x,y)(a,c),(b,c),(a,d)\in L(x,y) then (b,d)L(x,y)(b,d)\in L(x,y).

Removing other non minority pairs

Suppose for a,bL(x)a,b\in L(x), both (a,b),(b,a)(a,b),(b,a) are minority pairs. Now for every y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b}) either Lx,a(y,z)=Lx,b(y,z)L_{x,a}(y,z)=L_{x,b}(y,z) or Lx,a(y,z)Lx,b(y,z)=L_{x,a}(y,z)\cap L_{x,b}(y,z)=\emptyset. Otherwise, according to Lemma 5.7, we would have a non minority pair (b1,b2)(b_{1},b_{2}) in L(w)L(w), wB(Ga,bL,x)w\in B(G^{L,x}_{a,b}) and we can handle such non minority pairs according to function Clean-Up in Algorithm 3 (also according Algorithm 2). The proof of correctness of the function Clean-Up appears in Lemma 5.7 (3). Suppose we have removed non minority pairs (b1,b2)(b_{1},b_{2}) with b1,b2L(w)b_{1},b_{2}\in L(w). Now we consider vertex yGa,bL,xy\in G^{L,x}_{a,b}, and two elements c1,c2Lx,a(y)c_{1},c_{2}\in L_{x,a}(y). Since, (a,c1),(a,c2),(b,c1),(b,c2)(a,c_{1}),(a,c_{2}),(b,c_{1}),(b,c_{2}) are still in Lx,a(x,y)L_{x,a}(x,y), (c1,c2),(c2,c1)(c_{1},c_{2}),(c_{2},c_{1}) are still minority pairs, and hence we further consider Gc1,c2Lx,a,yG^{L_{x,a},y}_{c_{1},c_{2}}, and Lx,aL_{x,a} and further remove other non minority pairs. We continue this process, until we reach the entire GG, with the lists Lx,aL_{x,a}. At this point ask the RemoveMinorty(G,H,Lx,aG,H,L_{x,a}). If there is an answer then we have a homomorphism from GG to HH that maps xx to aa and we return such a homomorphism.

1:Input: Digraphs GG, lists LL
2:function Getting-to-Minority(G,H,LG,H,L )
3:     Let xx be a vertex in GG with |L(x)|>1|L(x)|>1
4:     for  every two distinct a,bL(x)a,b\in L(x)  do
5:         L1=LL_{1}=L
6:         L=L^{\prime}=Clean-UP(G,H,L1,x,a,bG,H,L_{1},x,a,b)
7:         g=g= RemoveMinority(G,H,LG,H,L^{\prime})
8:         if gg\neq\emptyset  then
9:              return gg               
10:     g=g=Getting-to-Minortiy(G,H,Lx,aG,H,L_{x,a})
11:     return gg
1:Input: Digraphs GG, lists LL, xV(G)x\in V(G), a,bL(x)a,b\in L(x)
2:function Make-Rectangle(G,H,L,x,a,bG,H,L,x,a,b )
3:     for yGy\in G, c,dL(y)c,d\in L(y) do
4:         if  (a,c),(a,d),(b,d)L(x,y)(a,c),(a,d),(b,d)\in L(x,y) and (b,c)L(x,y)(b,c)\not\in L(x,y) then
5:              remove (a,c)(a,c) from L(x,y)L(x,y)          
6:         if  (a,c),(b,c),(b,d)L(x,y)(a,c),(b,c),(b,d)\in L(x,y) and (b,d)L(x,y)(b,d)\not\in L(x,y) then
7:              remove (a,c)(a,c) from L(x,y)L(x,y)               
8:     PreProcessing(G,H,LG,H,L)
9:     return (L)(L)
1:Input: Digraphs G,HG,H, and lists LL
2:function Clean-up(G,H,L,x,a,bG,H,L,x^{\prime},a^{\prime},b^{\prime} )
3:     Let StSt be an empty Stack.
4:     push(x,a,b)x^{\prime},a^{\prime},b^{\prime}) into StSt.
5:     while  StSt is not empty do
6:         (x,a,b)(x,a,b) = pop(StSt) and set Visit[x,a,bx,a,b]=true
7:         Make-Rectangle(G,H,L,x,a,bG,H,L,x,a,b)
8:         for y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b})  do
9:              Let c,dL(y)c,d\in L(y) and e,lL(z)e,l\in L(z) s.t. x,a,bx,a,b, y,c,dy,c,d and x,a,bx,a,b, z,e,lz,e,l are rectangles.
10:              Let vv be a vertex at the intersection of YY from xx to YY and ZZ from xx to zz in GG.
11:              Let a1,a2,a3,a4L(v)a_{1},a_{2},a_{3},a_{4}\in L(v) such that (a,a1),(a,a3),(b,a2),(b,a4)L(x,v)(a,a_{1}),(a,a_{3}),(b,a_{2}),(b,a_{4})\in L(x,v).
12:              if  (a1,e),(a4,e),(a2,l),(a3,l)L(v,z)(a_{1},e),(a_{4},e),(a_{2},l),(a_{3},l)\in L(v,z)  then
13:                  Let a5L(v)a_{5}\in L(v) s.t. (b,a5)L(x,v)(b,a_{5})\in L(x,v), (a5,c)Lx,b(v,y)(a_{5},c)\in L_{x,b}(v,y) and (a5,e)Lx,b(y,z)(a_{5},e)\in L_{x,b}(y,z).
14:                  if a6L(v)\not\exists a_{6}\in L(v) s.t. (a,a6)L(x,v)(a,a_{6})\in L(x,v), (a6,e)Lx,a(v,z)(a_{6},e)\in L_{x,a}(v,z), (a6,d)Lx,a(v,y)(a_{6},d)\not\in L_{x,a}(v,y)  then
15:                       remove (a,d),(b,d)(a,d),(b,d) from L(x,y)L(x,y)
16:                       PreProcessing(G,H,LG,H,L)                   
17:                  if  a7L(v)\not\exists a_{7}\in L(v) s.t. (b,a7)L(x,v)(b,a_{7})\in L(x,v), (a7,c)Lx,b(v,y)(a_{7},c)\in L_{x,b}(v,y), (a7,l)Lx,b(v,z)(a_{7},l)\not\in L_{x,b}(v,z)  then
18:                       remove (a,l),(b,l)(a,l),(b,l) from L(x,y)L(x,y)
19:                       PreProcessing(G,H,LG,H,L)                                 
20:              if  (a1,e),(a2,e),(a3,l),(a4,l)L(v,z)(a_{1},e),(a_{2},e),(a_{3},l),(a_{4},l)\in L(v,z)  then
21:                  Let a5L(v)a_{5}\in L(v) s.t. (a,a5)L(x,v)(a,a_{5})\in L(x,v), (a5,c)Lx,a(v,y)(a_{5},c)\in L_{x,a}(v,y), (a5,l)Lx,a(y,z)(a_{5},l)\in L_{x,a}(y,z).
22:                  if  a6L(v)\not\exists a_{6}\in L(v) s.t. (a,a6)L(x,v)(a,a_{6})\in L(x,v), (a6,l)Lx,a(v,z)(a_{6},l)\in L_{x,a}(v,z), (a6,d)Lx,a(v,y)(a_{6},d)\not\in L_{x,a}(v,y)  then
23:                       remove (a,d),(b,d)(a,d),(b,d) from L(x,y)L(x,y)
24:                       PreProcessing(G,H,LG,H,L)                   
25:                  if  a7L(v)\not\exists a_{7}\in L(v) s.t. (a,a7)L(x,v)(a,a_{7})\in L(x,v), (a7,c)Lx,a(v,z)(a_{7},c)\in L_{x,a}(v,z), (a7,l)Lx,a(v,y)(a_{7},l)\not\in L_{x,a}(v,y)  then
26:                       remove (a,l),(b,l)(a,l),(b,l) from L(x,y)L(x,y)
27:                       PreProcessing(G,H,LG,H,L)                                          
28:         if  (a,d),(a,d),(b,c),(b,d)L(x,y)(a,d),(a,d),(b,c),(b,d)\in L(x,y) and Visit[y,c,d]y,c,d]=false  then push(y,c,dy,c,d) into StSt          
29:         if  (a,e),(a,l),(b,e),(b,l)L(x,z)(a,e),(a,l),(b,e),(b,l)\in L(x,z)   and Visit[z,e,l]z,e,l]=false  then push(z,e,lz,e,l) into StSt               
30:     return (L)(L)

Deploying Maltsev algorithm

Now we can deploy the procedure RemoveMinority similar to Algorithm 1 in [38]. The goal is to eliminate one of the a,ba,b from the list of xx. We construct a sub-digraph of GG which is initially G=Ga,bL,xB(Ga,bL,x)G^{\prime}=G^{L,x}_{a,b}\setminus B(G^{L,x}_{a,b}) in function G-xab (similar to Algorithm 1 in [38]). If there are vertices y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b}) so that Lx,a(y,z)Lx,b(y,z)=L_{x,a}(y,z)\cap L_{x,b}(y,z)=\emptyset, then we say a,ba,b are not identical on the boundary. In this case sub-digraph GG^{\prime} will be extended from a vertex yy and two elements c1,c2Lx,a(y)c_{1},c_{2}\in L_{x,a}(y). This is done by adding Gc1,c2L,yB(Gc1,c2L,y)G^{L,y}_{c_{1},c_{2}}\setminus B(G^{L,y}_{c_{1},c_{2}}) into GG^{\prime} and the boundary vertices of GG^{\prime} are updated by the vertices of B(Gc1,c2L,y)B(G^{L,y}_{c_{1},c_{2}}) that are not already in GG^{\prime}. If the procedure RemoveMinority finds a homomorphism that maps xx to aa in the sub-digraph GG^{\prime} then we remove bb from L(x)L(x), otherwise, we remove aa from L(x)L(x). Following the proof of correctness of the Algorithm 1 in [38] and Algorithm 2 we obtain the correctness of this procedure.

For every a,bL(x)a,b\in L(x), one of the (a,b),(b,a)(a,b),(b,a) is not minority

Let aL(x)a\in L(x) and let Lx,aL^{\prime}_{x,a} be the subset of lists Lx,aL_{x,a} in which for every yGy\in G, and every c1,c2L(y)c_{1},c_{2}\in L(y), (c1,c2)(c_{1},c_{2}) is a minority pair. We get to this point because there is no Lx,aL^{\prime}_{x,a}-homomorphism from GG to HH that maps xx to aa. One reason is because at least one of the (a,b),(b,a)(a,b),(b,a) is not a minority pair for a,bL(x)a,b\in L(x). If for every cL(x)c\in L(x), (a,c)(a,c) is not a minority pair then at the end we should see whether there exists an Lx,aL_{x,a}-homomorphism from GG to HH.

Algorithm 4 RemoveMinority – Using Maltsev Property
1:function RemoveMinority(G,H,LG,H,L)
2:     Preprocessing(G,H,LG,H,L) and if a list becomes empty then return \emptyset
3:     Consider each connected component of G×LHG\times_{L}H separately \triangleright we assume G×LHG\times_{L}H is connected
4:     xV(G)\forall\ \ x\in V(G) and a,bL(x)\forall a,b\in L(x), if a,ba,b are twins then remove bb from L(x)L(x).
5:     for all  xV(G),a,bL(x)x\in V(G),a,b\in L(x) with aba\neq b  do
6:         (G,L)=(G^{\prime},L^{\prime})= G-xab(G,L,x,a,bG,L,x,a,b)
7:         ga,bx=g^{x}_{a,b}= RemoveMinority(G,H,LG^{\prime},H,L^{\prime})
8:         if  ga,bxg^{x}_{a,b} is empty  then remove aa from L(x)L(x)
9:         else remove bb from L(x)L(x)          
10:         Preprocessing (G,H,LG,H,L)      
11:     Set ψ\psi to be an empty homomorphism.
12:     if  xV(G)\exists x\in V(G) with L(x)L(x) is empty  then return \emptyset.
13:     else
14:         for all  xV(G)x\in V(G)  do
15:              ψ(x)=L(x)\psi(x)=L(x) \triangleright in this case the lists are singletons               
16:     return ψ\psi
1:Input: Digraphs GG, lists LL and, xV(G)x\in V(G), a,bL(x)a,b\in L(x)
2:function G-xab(G,L,x,a,bG,L,x,a,b)
3:     Set Ga,bL,x^=Ga,bL,xB(Ga,bL,x)\widehat{G^{L,x}_{a,b}}=G^{L,x}_{a,b}\setminus B(G^{L,x}_{a,b}), and B=B(Ga,bL,x)B^{\prime}=B(G^{L,x}_{a,b})
4:     Set stack SS to be empty and set L1=Lx,aL_{1}=L_{x,a}
5:     push x,a,bx,a,b into SS
6:     while  SS is not empty  do
7:         pop (x,a,b)(x^{\prime},a^{\prime},b^{\prime}) from SS
8:         for all  yBy\in B^{\prime} and c1,c2L1(y)c_{1},c_{2}\in L_{1}(y) s.t. y,c1,c2y,c_{1},c_{2} witness x,a,bx^{\prime},a^{\prime},b^{\prime} at z,d1,d2z,d_{1},d_{2}  do
9:              Add new vertices from Gc1,c2L1,yB(Gc1,c2L1,y)G^{L_{1},y}_{c_{1},c_{2}}\setminus B(G^{L_{1},y}_{c_{1},c_{2}}) into Ga,bL,x^\widehat{G^{L,x}_{a,b}}
10:              Update BB^{\prime} by adding new boundary vertices from B(Gc1,c2L1,y)B(G^{L_{1},y}_{c_{1},c_{2}}) and removing the old             boundary vertices from BB^{\prime} that become internal vertices
11:              push (y,c1,c2)(y,c_{1},c_{2}) into SS               
12:     Initialize new lists LL^{\prime} and yGa,bL,x^\forall y\in\widehat{G^{L,x}_{a,b}}, set L(y)=L1(y)L^{\prime}(y)=L_{1}(y)
13:     return (Ga,bL,x^,L)(\widehat{G^{L,x}_{a,b}},L^{\prime}) \triangleright LL^{\prime} lists should be (2,3)(2,3)-consistent
Lemma 5.7

Suppose a,bL(x)a,b\in L(x) and both (a,b)(a,b), (b,a)(b,a) are minority pairs. Then one of the following occurs.

  1. 1.

    For every y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b}), Lx,a(y,z)=Lx,b(y,z)L_{x,a}(y,z)=L_{x,b}(y,z), and wB(Ga,bL,x),c1,c2Lx,a(w)\forall w\in B(G^{L,x}_{a,b}),c_{1},c_{2}\in L_{x,a}(w), (c1,c2)(c_{1},c_{2}) is minority.

  2. 2.

    For every y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b}), Lx,a(y,z)Lx,b(y,z)=L_{x,a}(y,z)\cap L_{x,b}(y,z)=\emptyset, and wB(Ga,bL,x),c1,c2Lx,a(w)\forall w\in B(G^{L,x}_{a,b}),c_{1},c_{2}\in L_{x,a}(w), (c1,c2)(c_{1},c_{2}) is minority.

  3. 3.

    There is wB(Ga,bL,x)w\in B(G^{L,x}_{a,b}) and vertices b1,b2Lx,a(w)b_{1},b_{2}\in L_{x,a}(w) such that (b1,b2)(b_{1},b_{2}) is not a minority pair.

Proof: First assume for every yB(Ga,bL,x)y\in B(G^{L,x}_{a,b}) and every c,dLx,a(y)c,d\in L_{x,a}(y), (c,d)(c,d) is a minority pair and every c,dLx,b(y)c,d\in L_{x,b}(y), (c,d)(c,d) is a minority pair. Let e,lL(z)e,l\in L(z) such that (a1,e)L(v,z)(a_{1},e)\in L(v,z) and (a3,l)L(v,z)(a_{3},l)\in L(v,z). Notice that since zB(Ga,bL,x)z\in B(G^{L,x}_{a,b}), we must have a rectangle forming with x,a,bx,a,b and z,c,dz,c,d. Without lose of generality we may assume that the internal vertices of this rectangle in L(v)L(v) are a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} (see Figure 14).

Refer to caption
Figure 14: The pair lists on boundary vertices are the same.

First suppose (a2,e),(a4,l)L(v,z)(a_{2},e),(a_{4},l)\in L(v,z). Let a1L(v)a^{\prime}_{1}\in L(v) such that (a,a1)L(x,v)(a,a^{\prime}_{1})\in L(x,v) and (a1,c)L(v,y)(a^{\prime}_{1},c)\in L(v,y) and suppose (a1,t)L(v,z)(a^{\prime}_{1},t)\in L(v,z). Let f(v;a1,a1k2,a2)=a1′′f(v;a^{\prime}_{1},a_{1}^{k-2},a_{2})=a^{\prime\prime}_{1}. By applying ff on L(Y[v,x])[a1,a],L(Y[v,x])[a1,a],L(Y[v,x])[a2,b],L(Z[v,z])[a1,e],L(Z[v,z])[a2,e],L(Z[v,z])[a1,t],L(Y[v,x])[a^{\prime}_{1},a],\\ L(Y[v,x])[a_{1},a],L(Y[v,x])[a_{2},b],L(Z[v,z])[a_{1},e],L(Z[v,z])[a_{2},e],L(Z[v,z])[a^{\prime}_{1},t], we conclude that (a1′′,b)L(v,x)(a^{\prime\prime}_{1},b)\in L(v,x), (a1′′,c)L(v,y)(a^{\prime\prime}_{1},c)\in L(v,y), and (a1′′,t)L(v,z)(a^{\prime\prime}_{1},t)\in L(v,z). These mean that (t,c)Lx,a(z,y)(t,c)\in L_{x,a}(z,y) if and only if (t,c)Lx,b(z,y)(t,c)\in L_{x,b}(z,y). By symmetry, if there exists a4L(v)a^{\prime}_{4}\in L(v) such that (a4,d)L(v,y)(a^{\prime}_{4},d)\in L(v,y) and (b,a4)L(x,y)(b,a^{\prime}_{4})\in L(x,y) then (a4′′,t)Lx,b(z,y)(a^{\prime\prime}_{4},t)\in L_{x,b}(z,y) if and only if (a4′′,t)Lx,a(z,y)(a^{\prime\prime}_{4},t)\in L_{x,a}(z,y), and hence, (t,c)Lx,a(z,y)(t,c)\in L_{x,a}(z,y) if and only if (t,c)Lx,b(z,y)(t,c)\in L_{x,b}(z,y). Now suppose a2L(v)a^{\prime}_{2}\in L(v) such that (b,a2)L(x,v)(b,a^{\prime}_{2})\in L(x,v), (a2,c)L(v,y)(a^{\prime}_{2},c)\in L(v,y). Let (a2,t)L(v,z)(a^{\prime}_{2},t)\in L(v,z) and let f(v;a1,a2k2,a2)=a2′′f(v;a_{1},a_{2}^{k-2},a^{\prime}_{2})=a^{\prime\prime}_{2}. Again by applying the polymorphism ff on L(Y[v,x])[a2,a],L(Y[v,x])[a2,a],L(Y[v,x])[a2,b]L(Y[v,x])[a^{\prime}_{2},a],L(Y[v,x])[a_{2},a],L(Y[v,x])[a^{\prime}_{2},b] we conclude that (a2′′,a)L(v,x)(a^{\prime\prime}_{2},a)\in L(v,x). Therefore, (t,c)Lx,b(y,z)(t,c)\in L_{x,b}(y,z) if and only if (t,c)Lx,a(y,z)(t,c)\in L_{x,a}(y,z).

Second, suppose (a4,e),(a2,l)L(v,z)(a_{4},e),(a_{2},l)\in L(v,z) (see Figure 15). Let a1L(v)a^{\prime}_{1}\in L(v) such that (a,a1)L(x,v)(a,a^{\prime}_{1})\in L(x,v) and (a1,c)L(v,y)(a^{\prime}_{1},c)\in L(v,y) and suppose (a1,t)L(v,z)(a^{\prime}_{1},t)\in L(v,z). Notice that (t,c)Lx,a(z,y)(t,c)\in L_{x,a}(z,y). Let f(v;a1,a1k2,a4)=a4f(v;a^{\prime}_{1},a_{1}^{k-2},a_{4})=a^{\prime}_{4}. By applying ff on L(Y[v,x])[a1,a],L(Y[v,x])[a1,a],L(Y[v,x])[a1,b],L(Y[v,z])[a1,e],L(Y[v,z])[a4,e],L(Y[v,z])[a1,t],L(Y[v,y])[a1,c],L(Y[v,y])[a1,c],L(Y[v,x])[a4,d]L(Y[v,x])[a^{\prime}_{1},a],L(Y[v,x])[a_{1},a],L(Y[v,x])[a_{1},b],\\ L(Y[v,z])[a_{1},e],L(Y[v,z])[a_{4},e],L(Y[v,z])[a^{\prime}_{1},t],L(Y[v,y])[a^{\prime}_{1},c],L(Y[v,y])[a_{1},c],L(Y[v,x])[a_{4},d],
we conclude that (a4,b)L(v,x)(a^{\prime}_{4},b)\in L(v,x), (a4,d)L(v,y)(a^{\prime}_{4},d)\in L(v,y), (a4,t)L(v,z)(a^{\prime}_{4},t)\in L(v,z), and hence, (t,d)Lx,b(y,z)(t,d)\in L_{x,b}(y,z). By symmetry, when (b,a2)L(x,v)(b,a^{\prime}_{2})\in L(x,v), (a2,c)L(v,y)(a^{\prime}_{2},c)\in L(v,y), and (a2,r)L(v,z)(a^{\prime}_{2},r)\in L(v,z), then there exists a3L(v)a^{\prime}_{3}\in L(v) such that (a,a3)L(x,v)(a,a^{\prime}_{3})\in L(x,v), (a3,b)L(v,y)(a^{\prime}_{3},b)\in L(v,y), and (a3,r)L(v,z)(a^{\prime}_{3},r)\in L(v,z). We also observe that if (a3,e)L(v,z)(a_{3},e)\in L(v,z) then by rectangle property we have (a1,l),(a2,e),(a4,l)L(v,z)(a_{1},l),(a_{2},e),(a_{4},l)\in L(v,z) and now it is easy to see that Lx,a(y,z)=Lx,b(y,z)L_{x,a}(y,z)=L_{x,b}(y,z) and (1) holds. Thus we assume that (a3,e)L(y,z)(a_{3},e)\not\in L(y,z) and it also follows that (a2,e),(a1,l),(a4,l)L(v,z)(a_{2},e),(a_{1},l),(a_{4},l)\not\in L(v,z). Since, the choice of a1,a2,a3,a4a_{1},a_{2},a_{3},a_{4} are arbitrary, it is easy to see that Lx,a(y,z)Lx,b(y,z)=L_{x,a}(y,z)\cap L_{x,b}(y,z)=\emptyset.

Refer to caption
Figure 15: The pair lists on boundary vertices are disjoint

Proof of 3. Suppose none of the (2,3) occurs. Let y,zB(Ga,bL,x)y,z\in B(G^{L,x}_{a,b}), and let YY be an oriented path from xx to yy in Ga,bL,xG^{L,x}_{a,b} and ZZ be an oriented path from xx to zz. Let vv be a vertex in the intersection of Z,YZ,Y. Consider vertices a1,a2,a3,a4L(v)a_{1},a_{2},a_{3},a_{4}\in L(v) such that (a,a1),(a,a3),(b,a2),(b,a4)L(x,v)(a,a_{1}),(a,a_{3}),(b,a_{2}),(b,a_{4})\in L(x,v) and (a1,c),(a2,c),(a3,d),(a4,d)L(v,y)(a_{1},c),(a_{2},c),(a_{3},d),(a_{4},d)\in L(v,y). First assume that there exist e,lL(z)e,l\in L(z) such that (a1,e),(a4,e)L(v,z)(a_{1},e),(a_{4},e)\in L(v,z), and (a2,l),(a3,l)L(v,z)(a_{2},l),(a_{3},l)\in L(v,z). In this case, we have (e,c),(l,d)Lx,a(y,z)(e,c),(l,d)\in L_{x,a}(y,z), and (e,d),(l,c)Lx,b(y,z)(e,d),(l,c)\in L_{x,b}(y,z). We may assume that Lx,a(y,z),Lx,b(y,z)L_{x,a}(y,z),L_{x,b}(y,z) has an intersection. Without loss of generality, assume that there exists some a5Lx,b(v)a_{5}\in L_{x,b}(v) such that (a5,e)Lx,b(v,y)(a_{5},e)\in L_{x,b}(v,y), (a5,c)Lx,b(v,y)(a_{5},c)\in L_{x,b}(v,y), and (e,c)Lx,b(z,y)(e,c)\in L_{x,b}(z,y) (see Figure 16).

Refer to caption
Figure 16: Finding a non minority pair .

Let a6=f(v;a1,a5k2,a4)a_{6}=f(v;a_{1},a_{5}^{k-2},a_{4}). Notice that by applying ff on Y[x,y]Y[x,y], and L(Y[x,y])L(Y[x,y]), starting at (x;ak,b)(x;a^{k},b) to (v;a1,a5k2,a4)(v;a_{1},a_{5}^{k-2},a_{4}), we conclude that there is a path in L(Y[x,v])L(Y[x,v]) from aa to a6a_{6}. Moreover, by applying ff on Y[v,z]Y[v,z], and L(Y[v,z])L(Y[v,z]), starting at (x;a1,a5k2,a4)(x;a_{1},a_{5}^{k-2},a_{4}) to (z;ek)(z;e^{k}), we conclude that there is a path in L(Y[v,z])L(Y[v,z]) from a6a_{6} to ee so (a6,e)Lx,a(v,z)(a_{6},e)\in L_{x,a}(v,z). Finally, by applying the ff on Y[v,y]Y[v,y], L(Y[v,y])L(Y[v,y]), we would get a path in L(Y[v,y])L(Y[v,y]) from a6a_{6} to f(y;ck,d)f(y;c^{k},d). If (a6,d)L(v,y)(a_{6},d)\not\in L(v,y), then (c,d)(c,d) is not a minority pair, and hence, w=zw=z, and (b1,b2)=(c,d)(b_{1},b_{2})=(c,d). Notice that if there exists at least one a6L(v)a_{6}\in L(v) so that (a6,e)Lx,a(v,z)(a_{6},e)\in L_{x,a}(v,z), (a,a6)Lx,a(x,v)(a,a_{6})\in L_{x,a}(x,v), (a6,d)Lx,a(v,y)(a_{6},d)\in L_{x,a}(v,y) then we can’t conclude that (c,d)(c,d) is not a minority pair. So we may assume such a6a_{6} exists, and we continue. Let a7=f(v;a3,a6k2,a1)a_{7}=f(v;a_{3},a_{6}^{k-2},a_{1}). Notice that since ff is a polymorphism, (a,a7)Lx,a(x,v)(a,a_{7})\in L_{x,a}(x,v). Now if (a7,c)Lx,a(v,y)(a_{7},c)\not\in L_{x,a}(v,y) then f(x;dk,c)cf(x;d^{k},c)\neq c, and hence, (d,c)(d,c) is not a minority pair, and we set w=yw=y, and (b1,b2)=(d,c)(b_{1},b_{2})=(d,c). Thus, we continue by assuming (a7,c)Lx,a(v,y)(a_{7},c)\in L_{x,a}(v,y). Now by following, ff on Z[v,z]Z[v,z], L(Z[v,z])L(Z[v,z]) we conclude that (a7,f(v;ek,l))Lx,a(v,z)(a_{7},f(v;e^{k},l))\in L_{x,a}(v,z). Therefore, if (a7,l)Lx,a(z,v)(a_{7},l)\not\in L_{x,a}(z,v) then (e,l)(e,l) is not a minority pair and we can set w=zw=z, and (b1,b2)=(e,l)(b_{1},b_{2})=(e,l). Thus, we continue by assuming that (a7,l)Lx,a(v,z)(a_{7},l)\in L_{x,a}(v,z), and hence, (l,c)Lx,a(z,y)Lx,b(z,y)(l,c)\in L_{x,a}(z,y)\cap L_{x,b}(z,y).

Next, let f(v;a2,a5k,a4)=a8f(v;a_{2},a_{5}^{k},a_{4})=a_{8}. Now by applying ff, we conclude that (b,a8)L(x,v)(b,a_{8})\in L(x,v). By following, ff on Z[v,z]Z[v,z], L(Z[v,z])L(Z[v,z]) we conclude that (a8,l)Lx,b(v,z)(a_{8},l)\in L_{x,b}(v,z), otherwise, (e,l)(e,l) is not minority pair and we are done. By following, ff on Z[v,y]Z[v,y], L(Y[v,y])L(Y[v,y]), we conclude that (a8,d)Lx,b(v,y)(a_{8},d)\in L_{x,b}(v,y), otherwise, (c,d)(c,d) is not a minority pair. Therefore, (l,d)Lx,a(z,y)Lx,b(z,y)(l,d)\in L_{x,a}(z,y)\cap L_{x,b}(z,y). Since a5a_{5} was an arbitrary vertex, we conclude that Lx,a(y,z)=Lx,b(y,z)L_{x,a}(y,z)=L_{x,b}(y,z), a contradiction to our assumption. The argument when (a1,e),(a2,e)L(v,z)(a_{1},e),(a_{2},e)\in L(v,z) and (a3,l),(a4,l)L(v,z)(a_{3},l),(a_{4},l)\in L(v,z) is similar. Note that when one of the (1,2) occurs on B(Ga,bL,x)B(G^{L,x}_{a,b}) and (3) does happened and (3) does not happened then it is not difficult that we can assume that for every yB(Ga,bL,x)y\in B(G^{L,x}_{a,b}) and every c1,c2Lx,a(y)c_{1},c_{2}\in L_{x,a}(y), (c1,c2)(c_{1},c_{2}) is a minority pair. \diamond

Lemma 5.8

The Algorithm 3 correctly finds a homomorphism from GG to HH if one exists, and runs in polynomial time of |G||H||G||H| and a polynomial of |||\mathcal{H}|.

Proof: The correctness of the algorithm follows from the correctness of the Algorithm 2 and the algorithm in [38]. Moreover, as we argue in the text before the algorithm, Lemma 5.6, and Lemma 5.7 justify the way we handle the minority pairs. The Algorithm in [38] and Algorithm 2 are polynomial of ( poly(|G|)poly(|H|)poly(|G|)*poly(|H|)). By the construction of G,H,LG,H,L, the size of each list LL is a polynomial of \mathcal{H}. Therefore, it is not difficult to see that the Algorithm 3 runs in polynomial of |||\mathcal{H}|. \diamond

6 Experiment

We have implemented our algorithm and have tested it on some inputs. The instances are mainly constructed according to the construction in subsection 3.1.

Refer to caption
Figure 17: Oriented paths of height 7
Refer to caption
Figure 18: HH is constructed from a relation of 55-tuples and of arity 55. GG is constructed from a bipartite graph where each edge in GG is replaced by one of the oriented paths depicted in Figure 17.
Refer to caption
Figure 19: First two HH digraphs constructed by a relation of 99-tuples and of arity 55 (which is closed under a semmi-lattice block Maltsev polymorphism, 01,23,4501,23,45). The first two GG digraphs constructed from bipartite graphs by replacing their edges with oriented paths. The last instance, GG and HH are constructed from two relations according to the construction in Subsection 3.1
Refer to caption
Figure 20: In the first instance, GG and HH are constructed from two relations according to the construction in Subsection 3.1. In the last two instances, HH is based on relation of 1414-tuples and arity 55. GG is constructed from a bipartite graph using the oriented paths depicted in Figure 17.
Refer to caption
Figure 21: The examples constructed from random relations GG and random target relations HH. The HH relations are closed under a weak NU polymorphims of arity 3 which are not semilattice-block-Maltsev.
Acknowledgements:

We would like to thank Víctor Dalmau, Ross Willard, Pavol Hell, and Akbar Rafiey for so many helpful discussions and useful comments.

References

  • [1] E. Allender, M. Bauland, N. Immerman, H. Schnoor, and H. Vollmer. The complexity of satisfiability problems: refining schaefer’s theorem. Journal of Computer and System Sciences, 75(4): 245–254 (2009).
  • [2] J. Bang-Jensen, P. Hell, and G. MacGillivray. The complexity of colouring by semicomplete digraphs. SIAM J. Discrete Math., 1 : 281–298, 1988.
  • [3] J. Bang-Jensen and P. Hell. The effect of two cyles on the complexity of colourings by directed graphs. Discrete Appl. Math., 26 : 1–23, 1990.
  • [4] L. Barto, M. Kozik, and T. 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 J. Comput, 38(5) : 1782–1802, 2009.
  • [5] R. Brewster, T. Feder, P. Hell, J. Huang, and G.MacGillivray. Near-unanimity functions and varieties of reflexive graphs. SIAM Journal on Discrete Mathematics, 22(3) :938–960, 2008.
  • [6] L.Barto, A.Krokhin, and R.Willard. Polymorphisms, and how to use them. Dagstuhl Follow-Ups, 7, Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2017.
  • [7] A. Bulatov. A dichotomy theorem for constraints on a three-elements sets. Journal of the ACM, 53(1): 66–120, 2006.
  • [8] A.Bulatov. Complexity of conservative constraint satisfaction problem. Journal of ACM Trans. Comput. Logic, 12(4) : 24–66, 2011.
  • [9] A. Bulatov. A dichotomy theorem for nonuniforms CSPs. In Proceedings of the 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 319–330, 2017.
  • [10] A. Bulatov and V. Dalmau. A simple algorithm for Maltsev constraint. SIAM J. Comput., 36(1): 16–27, 2006.
  • [11] A. Bulatov, P. Jeavons, and A. Krokhin. Classifying the complexity of constraint using finite algebras. SIAM journal on computing, 34(3): 720-742, 2005.
  • [12] J.Y. Cai, X. Chen, and P. Lu. Graph homomorphisms with complex values: A dichotomy theorem. SIAM J. Comput., 42(3): 924–1029, 2013.
  • [13] C. Carvalho, V.Dalmau, and A. Krokhin. CSP duality and trees of bounded pathwidth. Theor. Comput. Sci., 411(34–36): 3188–3208, 2010.
  • [14] H. Chen, B. Larose. Asking the metaquestions in constraint tractability. ACM Transactions on Computation Theory (TOCT), 9 (3), 2017.
  • [15] N. Creignou, S. Khanna, and M. Sudan. Complexity classifications of boolean constraint satisfaction problems. SIAM Monographs on Discrete Math. and Applications, vol. 7, 2001.
  • [16] P. Csikvári and Z. Lin. Graph homomorphisms between trees. Elec. J. Combin., 21 : 4–9 ,2014.
  • [17] R. Dechter. Constraint networks. Encyclopedia of Artificial Intelligence 276–285 , 1992.
  • [18] V. Dalmau. A new tractable class of constraint satisfaction problems. In Proceedings 6th International Symposium on Artificial Intelligence and Mathematics, 2000.
  • [19] V. Dalmau, D. Ford. Generalized satisfiability with kk occurrences per variable: A study through delta-matroid parity. In Proceedings of MFCS 2003, Lecture Notes in Computer Science, 2747 : 358–367, 2003.
  • [20] L.Egri, P.Hell, B.Larose, and A.Rafiey. Space complexity of list H-coloring : a dichotomy. In Proceedings of SODA, 2014.
  • [21] T. Feder. Homomorphisms to oriented cycles and kk-partite satisfiability. SIAM J. Discrete Math., 14 : 471–480, 2001.
  • [22] T. Feder A dichotomy theorem on fixed points of several nonexpansive mappings. SIAM J. Discrete Math., 20 : 291–301, 2006.
  • [23] T. Feder and P. Hell. List homomorphisms to reflexive graphs. J. Comb. Theory Ser., B 72 : 236–250, 1998.
  • [24] T.Feder, P.Hell, and J.Huang. Bi-arc graphs and the complexity of list homomorphisms. J. Graph Theory, 42 : 61–80, 1999.
  • [25] T. Feder, P. Hell, J. Huang. List homomorphisms and circular arc graphs. Combinatorica, 19 : 487–505 (1999).
  • [26] T. Feder, P. Hell, and J. Huang. Bi-arc graphs and the complexity of list homomorphisms. J. Graph Theory, 42 : 61–80 ,2003.
  • [27] T. Feder, P. Hell, B. Larose, C. Loten, M. Siggers, C. Tardif. Graphs admitting k-NU operations. Part 1: The reflexive case. SIAM Journal on Discrete Mathematics, 27 (4) : 1940–1963 (2013).
  • [28] T. Feder, F. Madelaine, and I.A. Stewart. Dichotomies for classes of homomorphism problems involving unary functions. Theoret. Comput. Sci., 314 : 1–43, 2004.
  • [29] T.Feder and M.Vardi. Monotone monadic SNP and constraint satisfaction. In Proceedings of STOC, 612–622, 1993.
  • [30] T. Feder and M.Y. Vardi. The computational structure of monotone monadic SNP constraint satisfaction: A study through Datalog and group theory. SIAM Journal on Computing, 28(1): 57–104, 1998.
  • [31] P. Hell and J. Nešetřil. On the complexity of HH-colouring. J. Combin. Theory B, 48 : 92–110, 1990.
  • [32] P. Hell and J. Nešetřil. Graphs and Homomorphisms, Oxford University Press, 2004.
  • [33] P.Hell and J.Nešetřil. Colouring, constraint satisfaction, and complexity. Computer Science Review , 2(3): 143–163, 2008.
  • [34] P.Hell, A.Rafiey, A.Rafiey. Bi-arc digraphs and conservative polymorphisms.
    CoRR, arxiv.org/abs/1608.03368v5, 2020.
  • [35] P.Hell and A.Rafiey. The dichotomy of list homomorphisms for digraphs. In Proceedings of SODA 1703–1713, 2011.
  • [36] P. Hell and A. Rafiey. The dichotomy of minimum cost homomorphism problems for digraphs. SIAM J. Discrete Math., 26(4): 1597–1608, 2012.
  • [37] A. Kazda. Maltsev digraphs have a majority polymorphism. Eur. J. Comb, 32(3): 390-397, 2011.
  • [38] J. Kinne, A. Murali, and A. Rafiey. Digraphs homomorphism problems with Maltsev condition. CoRR, arxiv.org/abs/2008.09921, 2020.
  • [39] L.G. Kroon, A. Sen, H. Deng, A. Roy. The optimal cost chromatic partition problem for trees and interval graphs. In Graph-Theoretic Concepts in Computer Science (Cadenabbia, 1996), Lecture Notes in Computer Science, 1197 : 279–292, 1997.
  • [40] V. Kumar. Algorithms for constraint-satisfaction problems. AI Magazine, 13 :32–44, 1992.
  • [41] P. Jeavons. On the algebraic structure of combinatorial problems. Theor. Comput. Sci., 200(1-2): 185-204 , 1998.
  • [42] R. Ladner. On the structure of polynomial time reducibility. Journal of the ACM (JACM), 22(1): 155–171, 1975.
  • [43] B. Larose, L. Zádori. The complexity of the extendibility problem for finite posets. SIAM J. Discrete Math., 17 : 114–121, 2003.
  • [44] M. Maroti, and R. McKenzie. Existence theorems for weakly symmetric operations. Algebra Universalis, 59 : 463–489, 2008.
  • [45] T.J. Schaefer. The complexity of satisfiability problems. In Proceedings of STOC, 216–226 (1978).
  • [46] M.H.Siggers. A new proof of the H-coloring dichotomy. SIAM J. Discrete Math., 23 (4) : 2204–2210, 2010.
  • [47] M.H.Siggers. A strong Maltsev condition for locally finite varieties omitting the unary type. Algebra universalis, 64(1-2):15–20, 2010.
  • [48] M.Y. Vardi. Constraint satisfaction and database theory: a tutorial. Proceedings of the 19th Symposium on Principles of Database Systems (PODS), 76–85, 2000.
  • [49] R.Willard. Refuting Feder, Kinne, and Rafiey. In CoRR, arXiv:1707.09440v1, 2017.
  • [50] D.Zhuk. A proof of CSPs conjecture. In Proceedings of the 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 331–342, 2017.