Digraph homomorphism problem and weak near unanimity polymorphism
DDigraph homomorphism problems and weak near unanimitypolymorphisms
Tom´as Feder ∗ Jeff Kinne † Ashwin Murali ‡ Arash Rafiey § Abstract
We consider the problem of finding a homomorphism from an input digraph G to a fixeddigraph H . We show that if H admits a weak near unanimity polymorphism φ then decidingwhether G admits a homomorphism to H (HOM( H )) is polynomial time solvable. This givesa proof of the dichotomy conjecture (now dichotomy theorem) by Feder and Vardi [29]. Ourapproach is combinatorial, and it is simpler than the two algorithms found by Bulatov [9] andZhuk [50] in 2017. We have implemented our algorithm and show some experimental results. Weuse our algorithm together with the recent result [38] for recognition of Maltsev polymorphismsand decide in polynomial time if a given relational structure R admits a weak near unanimitypolymorphism. For a digraph G , let V ( G ) denote the vertex set of G and let A ( G ) denote the arcs (aka edges) of G . An arc ( u, v ) is often written as simply uv to shorten expressions. Let | G | denote the numberof vertices in G .A homomorphism of a digraph G to a digraph H is a mapping g of the vertex set of G to thevertex set of H so that for every arc uv of G the image g ( u ) g ( v ) is an arc of H . A natural decisionproblem is whether for given digraphs G and H there is a homomorphism of G to H . 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 k -coloring problemshows that this decision problem is N P -hard: a graph G admits a 3-coloring if and only if thereis a homomorphism from G to K , the complete graph on 3 vertices. As a homomorphism iseasily verified if the mapping is given, the homomorphism problem is contained in N P and is thus
N P -complete.The following version of the problem has attracted much recent attention. For a fixed digraph H the problem HOM ( H ) asks if a given input digraph G admits a homomorphism to H . Notethat while the 3-coloring reduction shows HOM ( K ) is NP-complete, HOM ( H ) can be easy (in P ) for some graphs H : for instance if H contains a vertex with a self-loop, then every graph G admits a homomorphism to H . Less trivially, for H = K (or more generally, for any bipartite ∗
268 Waverley Street, Palo Alto, CA 94301, United States, [email protected] † Indiana State University, IN, USA, [email protected], Supported by NSF grant 1751765 ‡ Indiana State University, IN, USA, [email protected], supported by NSF 1751765 § Indiana State University, IN, USA arash.rafi[email protected] and Simon Fraser University, BC, Canada,[email protected], Supported by NSF grant 1751765 a r X i v : . [ c s . CC ] N ov raph H ), there is a homomorphism from G to K if and only if G is bipartite. A very naturalgoal is to identify precisely for which digraphs H the problem HOM ( H ) is easy. In the specialcase of graphs the classification has turned out to be this: if H contains a vertex with a self-loop oris bipartite, then HOM ( H ) is in P , otherwise it is N P -complete [31] (see [46] for shorter proofs).This classification result implies a dichotomy of possibilities for the problems
HOM ( H ) when H isa graph, each problem being N P -complete or in P . However, the dichotomy of HOM ( H ) remainedopen for general digraphs H for a long time. It was observed by Feder and Vardi [29] that thisproblem is equivalent to the dichotomy of a much larger class of problems in N P , in which H is afixed finite relational structure. These problems can be viewed as constraint satisfaction problems with a fixed template H [29], written as CSP( H ).The CSP( 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 H ) to the variables satisfying all of theconstraints.This problem can be formulated in terms of homomorphims as follows. Given a pair ( G , H ) of relational structures , decide whether or not there is a homomorphism from the first structure tothe second structure.3SAT is a prototypical instance of CSP, where each variable takes values of true or false (adomain size of two) and the clauses are the constraints. Digraph homomorphism problems can alsoeasily be converted into CSPs: the variables V are the vertices of G , each must be assigned a vertexin H (meaning a domain size of | V ( H ) | ), and the constraints encode that each arc of G must bemapped to an arc in H .Feder and Vardi argued in [29] that in a well defined sense the class of problems CSP ( H ) wouldbe the largest subclass of N P in which a dichotomy holds. A fundamental result of Ladner [42]asserts that if P (cid:54) = N P then there exist
N P -intermediate problems (problems neither in P nor N P -complete), which implies that there is no such dichotomy theorem for the class of all
N P problems.Non-trivial and natural sub-classes which do have dichotomy theorems are of great interest. Federand Vardi made the following
Dichotomy Conjecture : every problem
CSP ( H ) is N P -complete oris in P . This problem has animated much research in theoretical computer science. For instancethe conjecture has been verified when H is a conservative relational structure [8], or a digraph withall in-degrees and all-out-degrees at least one [4]. Numerous special cases of this conjecture havebeen 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 announcedanother algebraic proof of the conjecture.It should be remarked that constraint satisfaction problems encompass many well known compu-tational problems, in scheduling, planning, database, artificial intelligence, and constitute an impor-tant 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 boundarybetween easy and hard CSP -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 obser-vation that the complexity of
CSP ( H ) only depends on certain symmetries of H , the so-called polymorphisms of H . For a digraph H a polymorphism φ of arity k on H is a homomorphismfrom H k to H . Here H k is a digraph with vertex set { ( a , a , . . . , a k ) | a , a , . . . , a k ∈ V ( H ) } andarc set { ( a , a , . . . , a k )( b , b , . . . , b k ) | a i b i ∈ A ( H ) for all 1 ≤ i ≤ k } . For a polymorphism φ , φ ( a , a , . . . , a k ) φ ( b , b , . . . , b k ) is an arc of H whenever ( a , a , . . . , a k )( b , b , . . . , b k ) is an arc of H k . 2ver 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 werethus a number of equivalent conditions on H that were postulated to describe which problems CSP ( H ) are in P . For each, it was shown that if the condition is not satisfied then the problem CSP ( H ) is N P -complete (see also the survey [33]). One such condition is the existence of aweak near unanimity polymorphism (Maroti and McKenzie [44]). A polymorphism φ of H of arity k is a k -near unanimity function ( k -NU) on H , if φ ( a, a, . . . , a ) = a for every a ∈ V ( H ), and φ ( a, a, . . . , a, b ) = φ ( a, a, . . . , b, a ) = · · · = φ ( b, a, . . . , a ) = a for every a, b ∈ V ( H ). If we only have φ ( a, a, . . . , a ) = a for every a ∈ V ( H ) and φ ( a, a, . . . , a, b ) = φ ( a, a, . . . , b, a ) = · · · = φ ( b, a, . . . , a )[not necessarily a ] for every a, b ∈ V ( H ), then φ is a weak k -near unanimity function (weak k -NU).A polymorphism φ on H is Siggers if φ ( a, r, e, a ) = φ ( r, a, r, e ) for every a, r, e ∈ H [47]. It hasbeen shown by Siggers [47] that if digraph H admits a Sigger polymorphism it also admits a weak k -NU for some k ≥ N P -completeness proofs that are known, the proof of the Dichotomy Conjecture re-duces to the claim that a relational structure H which admits a weak near unanimity polymorphismhas a polynomial time algorithm for CSP ( H ). As mentioned earlier, Feder and Vardi have shownthat is suffices to prove this for HOM ( H ) when H is a digraph. This is the main result of ourpaper.Note that the real difficulty in the proof of the graph dichotomy theorem in [31] lies in proving the N P -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 developedtechniques from logic and algebra, and to obtain an algebraic proof, we go in the opposite directionand develop a combinatorial algorithm. Our main result is the following.
Theorem 1.1
Let H be a digraph that admits a weak near unanimity function. Then HOM ( H ) is in P . Deciding whether an input digraph G admits a homomorphism to H can be done in time O ( | G | | H | k +4 ) . Very High Level View
We start with a general digraph H and a weak k -NU φ of H . We turnthe problem HOM ( H ) into a related problem of seeking a homomorphism with lists of allowedimages. The list homomorphism problem for a fixed digraph H , denoted LHOM ( H ), has as inputa digraph G , and for each vertex x of G an associated list (set) of vertices L ( x ) ⊆ V ( H ), and askswhether there is a homomorphism g of G to H such that for each x ∈ V ( G ), the image of x ; g ( x ),is in L ( x ). Such a homomorphism is called a list homomorphism of G to H with respect to thelists L . List homomorphism problems have been extensively studied, and are known to have nicedichotomies [23, 26, 35]. However, we can not use the algorithms for finding list homomorphismfrom G to H , because in the HOM ( H ) problem, for every vertex x of G , L ( x ) = V ( H ). Preprocessing
One of the common ingredients in
CSP algorithms is the use of consistencychecks to reduce the set of possible values for each variable (see, for example the algorithm out-lined in [32] for
CSP ( H ) when H admits a near unanimity function). Our algorithm includessuch 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 onthe list of vertices in the input digraph G . For each pair ( x, y ) of V ( G ) × V ( G ) we consider a listof possible pairs ( a, b ), a ∈ L ( x ) (the list in H associated with x ∈ V ( G )) and b ∈ L ( y ). Note3hat if xy is an arc of G and ab is not an arc of H then we remove ( a, b ) from the list of ( x, y ).Moreover, if ( a, b ) ∈ L ( x, y ) and there exists z such that there is no c for which ( a, c ) ∈ L ( x, z ) and( c, b ) ∈ L ( z, y ) then we remove ( a, b ) from the list of ( x, y ). We continue this process until no listcan be modified. If there are empty lists then clearly there is no list homomorphism from G to H . After PreProcessing
The main structure of the algorithm is to perform pairwise elimination ,which focuses on two vertices a, b of H that occur together in some list L ( x ) , x ∈ V ( G ), and findsa way to eliminate a or b from 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 L , there will still beone with respect to the updated lists L . This process continues until either a list becomes empty,certifying that there is no homomorphism with respect to L (and hence no homomorphism at all),or until all lists become singletons specifying a concrete homomorphism of G to H or we reach aninstance that has much simpler structure and can be solved by the existing CSP algorithms. Thismethod has been successfully used in other papers [20, 35, 36].In this paper, the choice of which a or b is eliminated, and how, is governed by the given weaknear unanimity polymorphism φ . The heart of the algorithm is a delicate procedure for updatingthe lists L ( x ) in such a way that (i) feasibility is maintained, and the polymorphism f keep itsinitial property (which is key to maintaining feasibility). Meta-Question
An interesting question arising from the study of CSP Dichotomy theorem isknown as the meta-question . Given a relational structure H , decide whether or not H admits apolymorphism from a class–for various classes of polymorphims. For many cases hardness resultsare known. Semmilattice, majority, Maltsev, NU, and weak NU, are among the popular polymor-phisms when it comes to study of CSP. Having one or more of these polymorphisms on relation H ,would make the CSP( H ) (or variation) instance tractable. Therefore, knowing structural character-ization and polynomial time recognition for these polymorphisms would help in designing efficientalgorithms for solving CSP. A binary polymorphism f on H is called semilattice if f ( a, b ) = f ( b, a ),and f ( a, a ) = a , f ( a, f ( a, c )) = f ( f ( a, b ) , c ) for every a, b, c ∈ V ( H ). A ternary polymorphism g on H is majority if g ( a, a, a ) = g ( a, a, b ) = g ( a, b, a ) = g ( b, a, a ) = a . A polymorphism h of arity threeon H is called Maltsev if for every a, b ∈ V ( H ), h ( 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 poly-morphism is NP-complete; a semilattice polymorphism, a conservative semilattice polymorphism, acommutative, associative polymorphism (that is, a commutative semigroup polymorphism). How-ever, when H is a single binary relation(digraph) then deciding whether H admits a conservativesemmilattice 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 givenrelational structure can be decided in polynomial time [6]. We transform this problem into a graphlist homomorphism problem from an input graph G to a target graph H , in which G × H admits aSiggers polymorphism (i.e. a weak NU polymorphism of arity k for some k ≥
3) with respect to thelists. To solve this problem, we need some modules of our algorithm for finding a homomorphismfrom G to H when H admits a weak NU. Moreover, we also need an algorithm for solving the listhomomorphism problem from an input graph G to a target graph H where G × H admits a Maltsvepolymorphism with respect to the lists; such an algorithm would only assume the existence of aMaltsev polymorphism without knowing the actual values. The later algorithm has been designed4n [38]. Deciding whether a relational structure admits a Malstve polymorphims has been an openproblem [6, 47]. We prove the following theorem. Theorem 1.2
Let R be a relational structure. Then the problem of deciding whether R admits aweak NU polymorphism is polynomial time solvable. Our algorithm (in manuscript 2017) makes a decision based on the output of a test T x,b,a on a smallerinstance of the digraph homomorphism problem. Here a, b are possible images for x ∈ V ( G ), of ahomomorphism from G to H .The algorithm assumes that the test T x,b,a outputs“yes” and based on the correctness of thetest, a is removed from further consideration for x . The test T x,b,a uses the properties of the weakNU polymorphism φ . However, it is conceivable that the test T x,b,a fails, and this means we shouldnot remove a from the list of possible images of x . We had incorrectly claimed in the manuscriptthat the properties of φ and pre-tests in the algorithm guarantee the test always passes. But wecan construct such an example where the test must fail in the algorithm as follows. Let H be adigraph with two weakly connected components H , H . The weak NU polymorphism φ could beof arity three and such that for every a ∈ H and every b ∈ H , φ ( a, b, b ) = φ ( b, b, a ) = φ ( b, a, b ) = c for some c ∈ H . Suppose there exists a homomorphism from G (weakly connected) to H thatmaps x to a and hence the entire graph G must be mapped to H . Moreover, suppose there is nohomomorphism from G to H . The algorithm does consider the test T x,b,a eventually for such G and H . According to the test T x,b,a , we remove a from further consideration for x which leads usto remove the possible homomorphism from G to H .Note that one can assume H is weakly connected as follows. Suppose H , H are balanceddigraphs with (cid:96) levels (we can partitioned the vertices of H i , i = 1 ,
2, into (cid:96) parts where all the arcsof H i go from a vertex in some part j to part j + 1). An extra vertex a (cid:48) can be added and connectedto all the vertices of H , H on the lowest level. This way we obtain the weakly connected digraph H = H ∪ H ∪ { a (cid:48) } with (cid:96) + 1 levels. We may assume G is also balanced and has (cid:96) levels. An extravertex x (cid:48) can be added to G with arcs to every vertex of G on the lowest level. Now G (cid:48) = G ∪ { x (cid:48) } is also a balanced digraph with (cid:96) + 1 levels. Note that in any homomorphism from G (cid:48) to H , x (cid:48) must be mapped to a (cid:48) and any other vertex of G (cid:48) must map to H − { x } .We note that Ross Willard has posted a concrete counter-example (and further discussion ofhis example) for which H contains 197 vertices in H . The example inspired by instances of theCSP, so-called Semi-lattice block Maltsev. In Subsection 3.1 and Section 6, we discuss these kindsof examples in detail and show how our new algorithm handles these examples. An oriented walk (path) is obtained from a walk (path) by orienting each of its edges. The net-length of a walk W , is the number of forward arcs minus the number of backward arcs following W from the beginning to the end. An oriented cycle is obtained from a cycle by orienting each of itsedges. We say two oriented walks X, Y are congruent if they follow the same patterns of forwardand backward arcs. 5or k digraphs G , G , . . . , G k , let G × G ×· · ·× G k be the digraph with vertex set { ( x , x , . . . , x k ) | x i ∈ V ( G i ) , ≤ i ≤ k } and arc set { ( x , x , . . . , x k )( x (cid:48) , x (cid:48) , . . . , x (cid:48) k ) | x i x (cid:48) i ∈ A ( G i ) , ≤ i ≤ k } . Let H k = H × H × . . . H , k times.Given digraphs G and H , and L : G → H , let G × L H k be the induced sub-digraph of G × H k with the vertices ( y ; a , a , . . . , a k ) where a , a , . . . , a k ∈ L ( y ). Definition 2.1 (Homomorphism consistent with Lists)
Let G and H be digraphs and listfunction L : V ( G ) → H , i.e. list of x ∈ V ( G ) , L ( x ) ⊆ V ( H ) . Let k > be an integer.A function f : G × L H k → H is a list homomorphism with respect to lists L if the followinghold. • List property : for every ( x ; a , a , . . . , a k ) ∈ G × L H k , f ( x ; a , a , . . . , a k ) ∈ L ( x ) • Adjacency property: if ( x ; a , ..., a k )( y ; b , ..., b k ) is an arc of G × L H k then f ( x ; a , ..., a k ) f ( y ; b , ..., b k ) is an arc of H . In addition if f has the following property then we say f has the weak k -NU property . • for every x ∈ V ( G ) , { a, b } ⊆ L ( x ), we have f ( x ; a, b, b, ..., b ) = f ( x ; b, a, b, ..., b ) = ... = f ( x ; b, b, b, ...a ). • for every x ∈ V ( G ), a ∈ L ( x ), we have f ( x ; a, a, . . . , a ) = a .We note that this definition is tailored to our purposes and in particular differs from the standarddefinition of weak k -NU as follows. f is based on two digraphs G and H rather than just H (wethink of this as starting with a traditional weak k -NU on H and then allowing it to vary somewhatfor each x ∈ V ( G )). Notation
For simplicity let ( b k , a ) = ( b, b, . . . , b, a ) be a k -tuple of all b ’s but with an a in the k th coordinate. Let ( x ; b k , a ) be a ( k + 1)-tuple of x , ( k − b ’s and a in the ( k + 1) th coordinate. Definition 2.2 ( f -closure of a list) We say a set S ⊆ L ( y ) is closed under f if for every k -tuple ( a (cid:48) , a (cid:48) , . . . , a (cid:48) k ) ∈ S k we have f ( y ; a (cid:48) , a (cid:48) , . . . , a (cid:48) k ) ∈ S . For set S ⊆ L ( y ) , let (cid:98) f y,S ⊆ L ( y ) be aminimal set that includes all the elements of S and it is closed under f . Let X : x , x , . . . , x n be an oriented path in G . Let X [ x i , x j ], 1 ≤ i ≤ j ≤ n , denote theinduced sub-path of X from x i to x j . Let L ( X ) denote the vertices of H that lie in the list of thevertices of X . Definition 2.3 (induced bi-clique)
We say two vertices x, y induced a bi-clique if there existvertices a , a , . . . , a r ∈ L ( x ) , r > and b , b , . . . , b s ∈ L ( y ) such that ( a i , b j ) ∈ L ( x, y ) for every ≤ i ≤ r and ≤ j ≤ s . Let a , a ∈ L ( x ) and suppose there exist b , b ∈ L ( y ) such that ( a , b ) , ( a , b ) , ( a , b ) , ( a , b ) ∈ L ( x, y ). Then it follows from the property of f , that (cid:98) f x, { a ,a } and (cid:98) f y, { b ,b } induce a bi-clique on x, y . 6 zd d e e Figure 1: An example of a Bi-clique
Definition 2.4 (weakly connected component in lists L ) By connected component of G × L H we mean a weakly connected component C of digraph G × L H (i.e. a connected componentof G × L H when we ignore the direction of the arcs) which is closed under (2 , -consistency.That means, for every ( x, a ) , ( y, b ) ∈ C , and every z ∈ V ( G ) there is some c ∈ L ( z ) such that ( a, c ) ∈ L ( x, z ) , ( b, c ) ∈ L ( y, z ) . Observation 2.5
If there exists a homomorphism g : G → H then all the vertices ( y, g ( y )) , y ∈ V ( G ) belong to the same connected component of G × L H . Definition 2.6
For a, b ∈ L ( x ) we say ( b, a ) is a non-minority pair if f ( x ; b k , a ) (cid:54) = a . Otherwise,we say ( b, a ) is a minority pair. Definition 2.7
For x ∈ V ( G ) , a ∈ L ( x ) , let L x,a be the subset of lists L that are consistent with x and a . In other words, for every y ∈ V ( G ) , L x,a ( y ) = { b ∈ L ( y ) | ( a, b ) ∈ L ( x, y ) } . Note that bydefinition L x,a ( x ) = { a } . In general for x , x , . . . , x t ∈ V ( G ) , let L x ,a ,x ,a ,...,x t ,a t be the subset oflists L that are consistent with all the a i ∈ L ( x i ) ’s, ≤ i ≤ t . In other words, for every y ∈ V ( G ) , L x ,a ,x ,a ,...,x t ,a t ( y ) = { b ∈ L ( y ) | ( a i , b ) ∈ L ( x i , y ) , i = 1 , , . . . , t } . The main algorithm starts with applying the Preprocessing procedure on the instance
G, H, L, φ ,where φ is a weak NU polymorphism of arity k on H . If we encounter some empty (pair) liststhen there is no homomorphism from G to H , and the output is no. Otherwise, it defines the weakNU list homomomorphism f : G × L H k → H , by setting f ( x ; a , a , . . . , a k ) = φ ( a , a , . . . , a k ) forevery x ∈ G and every a , a , . . . , a k ∈ 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-calledminority cases which are turned into a Maltsev instances, and can be handled using the existingMaltsev algorithms.
Minority Instances
Inside function
Not-Minority we first check whether the instance is Malt-sev or
Minority instance – in which we have a homomorphism f consistent with L such that forevery a, b ∈ L ( x ), ( b, a ) is a minority pair, i.e. f ( x ; b k , a ) = a , and in particular when a = b wehave f ( x ; a, a, . . . , a ) = a (idempotent property).In our setting a homomorphism h : G × L H → H is called Maltsev list homomorphism if h ( x ; a, a, b ) = h ( x ; b, a, a ) = b for every a, b ∈ L ( x ), x ∈ V ( G ).7 lgorithm 1 The main algorithm for solving the digraph homomorphism problem Input:
Digraphs
G, H , and, a weak NU homomorphism φ : H k → H function DigraphHom ( G, H, φ ) for all x ∈ V ( G ), let L ( x ) = V ( H ) if PreProcessing ( G, H, L ) is false then return ”no homomorphism” for all x ∈ V ( G ) and a , ..., a k ∈ L ( x ), let f ( x ; a , ..., a k ) = φ ( a , ..., a k ) g = Not-Minority ( G, H, L, f ) if g is not empty then return true else return false Input:
Digraphs
G, H , lists L and, a weak NU homomorphism f : G × L H k → H which isminority function RemoveMinority ( G, H, L, f ) for all x ∈ V ( G ), and a, b, c ∈ L ( x ) do Set h ( x ; a, b, c ) = f ( x ; a, b, b, . . . , b, c ) g = Maltsev-Algorithm ( G, H, L, h ) return g Let
G, H, L, f be an input to our algorithm, and suppose all the pairs are minority pairs.We define a homomorphism h : G × L H → H (consistent with L ) by setting h ( x ; a, b, c ) = f ( x ; a, b, b, . . . , b, c ) for a, b, c ∈ L ( x ). Note that since f has the minority property for all x ∈ V ( G ), a, b ∈ L ( x ), h is a Maltsev homomorphism consistent with the lists L . This is because when b = c then h ( x ; a, b, b ) = f ( x ; a, b, . . . , b ) = a , and when a = b , h ( x ; a, a, c ) = f ( x ; b, b, . . . , b, c ) = c , forevery a, c , and hence, h ( x ; b, b, a ) = a .The Maltsev/Minority instances can be solved using the algorithm in [10]. Although the algo-rithm in [10] assumes there is a global Maltsev, it is straightforward to adopt that algorithm towork in our setting. We can also use the Algorithm in [38]. Not-Minority Instances
Not-Minority algorithm (Algorithm 2) first checks whether theinstance 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 ) in L ( x ), i.e., w = ( x ; b k , a ) with f ( w ) = c (cid:54) = a .Roughly speaking, the goal is not to use f on vertices w = ( x ; e , e , . . . , e k ) with f ( w ) = a ;which essentially means setting f ( w ) = f ( w ). In order to make this assumption, it recursivelysolves a smaller instance of the problem (smaller test), say G (cid:48) ⊆ G , and L (cid:48) ⊂ L , and if the testis successful then that particular information about f is no longer needed. More precisely, let w = ( x ; b k , a ) ∈ G (cid:48) × L (cid:48) H k so that f ( w ) = c (cid:54) = a and where ( x, a ) , ( x, c ) are in the same connectedcomponent of G (cid:48) × L (cid:48) H . The test T x,c is performed to see whether there exists an L (cid:48) -homomorphism g from G (cid:48) to H with g ( x ) = c . If T x,c for G (cid:48) , L (cid:48) succeeds then the algorithms no longer uses f for w (cid:48) = ( x ; a , a , . . . , a k ) ∈ G (cid:48) × L (cid:48) H k with f ( w (cid:48) ) = a . We often use a more restricted test, say T x,c,y,d on G (cid:48) , L (cid:48) in which the goal is to see whether there exists an L (cid:48) -homomorphism g , from G (cid:48) to H with g ( x ) = c , g ( y ) = d .The Algorithm 2 is recursive, and we use induction on (cid:80) x ∈ V ( G ) | L ( x ) | to show its correctness.In what follows we give an insight of why the weak k -NU ( k >
2) property of H is necessary forour algorithm. For contradiction, suppose w = ( x ; b k , a ) with f ( w ) = c and w = ( x ; a, b, b, . . . , b )8ith f ( w ) = d . If d = a then in Not-Minority algorithm we try to remove a from L ( x ) (notto use a in L ( x )) if we start with w while we do need to keep a in L ( x ) because we later need a in L ( x ) for the Maltsev algorithm. It might be the case that d (cid:54) = a but during the execution ofAlgorithm 2 for some w = ( x ; b k , e ) with f ( w ) (cid:54) = e we assume f ( w ) is e . So we need to have f ( w ) = f ( w ), the weak NU property, to start in Algorithm 1. Algorithm 2 ruling out not-minority pairs, f remains a homomorphism of G × L H k to H and forevery x ∈ V ( G ), a (cid:48) , b (cid:48) ∈ L ( x ), we have f ( x ; a (cid:48) k , b (cid:48) ) = b (cid:48) Input:
Digraphs
G, H , lists L and, a weak NU homomorphism f : G × L H k → H function Not-Minority ( G, H, L, f ) if ∀ x ∈ V ( G ), | L ( x ) | = 1 then ∀ x ∈ V ( G ) set g ( x ) = L ( x ) return g If G × L H is not connected then consider each connected component separately if all the pairs are minority then g = RemoveMinority ( G, H, L, f ) return g for all y, z ∈ V ( G ), d , d ∈ L ( y ), e ∈ L ( z ) s.t. ( d , e ) , ( d , e ) ∈ L ( y, z ) do ( G (cid:48) , L (cid:48) ) = Sym-Diff ( G, L, y, d , d , z, e ) g y,zd ,e = Not-Minority ( G (cid:48) , H, L (cid:48) , f ) if g y,zd ,e is empty then Remove ( d , e ) from L ( y, z ), and remove ( e , d ) from L ( z, y ) if L ( y, z ) is empty then return ∅ else if G (cid:48) = G then return g y,zd ,e ( L, f ) =
Bi-Clique-Instances ( G, H, L, f ) PreProcessing ( G, H, L ) if ∃ empty list or ∃ empty pair list then return ∅ else g = RemoveMinority ( G, H, L, f ) return g For implementation, we update the lists L as well as the pair lists, depending on the output of T x,c . If T x,c fails (no L -homomorphism from G to H that maps x to c ) then we remove c from L ( x ) and if T x,c,y,d fails (no L -homomorphism from G to H that maps x to c and y to d ) thenwe remove ( c, d ) from L ( x, y ). The Not-Minority takes
G, L, f and checks whether all the listsare singleton, and in this case the decision is clear. It also handles each connected component of G × L H separately. If all the pairs are minority then it calls RemoveMinority which is essentiallychecking for a homomorphism when the instance admits a Maltsev polymorphism. Otherwise, itproceeds with function
Sym-Diff . Sym-Diff function
Let y, z ∈ V ( G ) and d , d ∈ L ( y ) and e ∈ L ( z ) such that ( d , e ) , ( d , e ) ∈ L ( y, z ). Let L = L z,e . We consider the instances G (cid:48) , H, L (cid:48) , f of the problem as follows. Theinduced sub-digraph G (cid:48) consists of vertices v of G such that for every ( d , j ) ∈ L ( y, v ) we have( d , j ) (cid:54)∈ L ( y, v ). Now for each v ∈ G (cid:48) , L (cid:48) ( v ) = { i | ( d , i ) ∈ L ( y, v ) } . Such an instance is9onstructed by function Sym-Diff ( G, L, y, d , d , z, e ).Let B ( G (cid:48) ) denote a set of vertices u in G \ G (cid:48) that are adjacent (via an out-going or in-comingarc) to some vertex v in G (cid:48) . B ( G (cid:48) ) is called the boundary of G (cid:48) . We do not add B (cid:48) ( G (cid:48) ) into G (cid:48) which makes it easier to argue about running time. However, we some extra care it is alsopossible to have an algorithm that include the boundary vertices. Note that for every v ∈ V ( G (cid:48) ), | L (cid:48) ( v ) | < | L ( v ) | . Moreover, L (cid:48) ( z ) = { e } , and L (cid:48) ( y ) = { d } .For y, z ∈ V ( G ) and d , d ∈ L ( y ) and e ∈ L ( z ) we solve the instance G (cid:48) , H, L (cid:48) , f , by callingthe Not-Minority ( G (cid:48) , H, L (cid:48) , f ) function. The output of this function call is either a non-empty L (cid:48) -homomorphism g y,zd ,e from G (cid:48) to H or there is no such homomorphism. If g y,zd ,e does not existthen there is no homomorphism from G to H that maps y to d , and z to e . In this case we remove( d , e ) from L ( y, z ), and remove ( e , d ) from L ( z, y ). This should be clear because G (cid:48) is an inducedsub-digraph of G , and for every vertex v ∈ V ( G (cid:48) ) \ { y, z } , L (cid:48) ( v, z ) = L ( v, z ), L (cid:48) ( v, y ) = L ( v, y ).Moreover, it is easy to see (will be shown later) that L (cid:48) is closed under f . The homomorphism g y,zd ,e is used in the correctness proof of the Algorithm 2. Implementation Remark:
In order to avoid several redundant tests, when a sub-digraph G (cid:48) constructed by Sym-Diff ( G, L, y, d , d , z, e ) is the same as G ; and the test returns true, then weno longer need to run the test for any other sub-instance ( G (cid:48)(cid:48) , L (cid:48)(cid:48) ) because we just need to returnyes to the parent sub-routine calling the current sub-routine. Input:
Digraphs G , lists L and, y, z ∈ V ( G ), d , d ∈ L ( y ), e ∈ L ( z ) function Sym-Diff ( G, L, y, d , d , z, e ) Create new empty lists L (cid:48) and let L = L z,e , and construct the pair lists L × L from L Set L (cid:48) ( z ) = e , L (cid:48) ( y ) = d , and set G (cid:48) = ∅ for all v ∈ V ( G ) s.t. ∀ i with ( i, d ) ∈ L ( v, y ) we have ( i, d ) (cid:54)∈ L ( v, y ) do add v into set G (cid:48) Let G (cid:48) be the induced sub-digraph of G Let B ( G (cid:48) ) = { u ∈ V ( G \ G (cid:48) ) | u is adjacent(in-neighbor or out-neighbor) to some v ∈ V ( G (cid:48) ) } for all u ∈ V ( G (cid:48) ) do L (cid:48) ( u ) = { i | ( d , i ) ∈ L ( y, u ) } for all u, v ∈ V ( G (cid:48) ) do L (cid:48) ( u, v ) = { ( a, b ) ∈ L ( u, v ) | ( a, b ) is consistent in G (cid:48) } . return ( G (cid:48) , L (cid:48) ) Bi-clique Instances
When instance I = G × L H has more than one connected componentwe consider each connected component separately. Otherwise, there exists a vertex y and twoelements d , d ∈ L ( y ) along with z ∈ V ( G ), e ∈ L ( z ) such that ( d , e ) , ( d , e ) ∈ L ( y, z ).Let d = f ( y ; d k , d ) (cid:54) = d . Suppose ( d , e ) , ( d , e ) ∈ L ( y, z ) after running Not-Minority on theinstances from
Sym-Diff ( G, L, y, d , d , z, e ) and Sym-Diff ( G, L, y, d , d , z, e ). Then we remove( d , e ) from 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 L by calling PreProcessing, be-cause reducing the pair lists may imply to remove some elements from the lists of some elementsof G . At this point, if a ∈ L ( x ) then f ( x ; a, a, . . . , a ) = a . This is because when a is in L ( x ) then10t means the Not-Minority procedure did not consider a to be excluded from further considera-tion. Notice that in order to feed this instance to RemoveMinority we only need the idempotentproperty for those vertices that are in L ( x ), x ∈ V ( G ). d d d e y z d e y zd d Figure 2: Explanation of how to reduce the pair lists. Input:
Digraphs G , lists L and, a weak NU homomorphism f : G × L H k → H function Bi-Clique-Instances ( G, H, L, f ) update=true while update do update=false Let d , d ∈ L ( y ), and e ∈ L ( z ) such that ( d , e ) , ( d , e ) ∈ L ( y, z ) and f ( y ; d k , d ) (cid:54) = d if there is such y, z, d , d , e then Remove ( d , e ) from L ( y, z ) and remove ( e , d ) from L ( z, y ) PreProcessing ( G, H, L ) update=true return ( L ) 11 x x x x t t t t x Q Q Q Q Q Q Q Q Q Q Q Q x (cid:48) x (cid:48) x (cid:48) x (cid:48) x (cid:48) t (cid:48) t (cid:48) t (cid:48) t (cid:48) x (cid:48) Q Q Q Q Q Q Q Q Q Q Q Q Q Q t Figure 4: The input digraph G We refer the reader to the example in [49]. The digraph H (depicted in Figure 3) admits a weakNU of arity 3. The input digraph G ( depicted in Figure 4). This digraph contains the originaldigraph used in [49] as an induced sub-digraph. So, our example here combines both examples usedin [49]. α β γ σ τ Figure 3:
There are oriented paths from 0 , , α, β, γ, σ, τ The lists in G × H are depicted in Figure 5. Clearly the G × L H has only one weakly connectedcomponent. 12 x x x x t t t t x α β βσαγαβ
01 0 10 αβγσ γσ γσ τττ τ t αβγστ x (cid:48) Figure 5:
Vertices in the ovals show the elements of H that are in the list of the vertices in G , the orientedpath between them are according to path Q , Q , Q , Q in G . For example, if x is mapped to 0 then t can be mapped to α, β . Now consider the
Sym-Diff ( G, L, t , σ, τ, x (cid:48) , Sym-Diff wehave, V ( G (cid:48) ) = { x (cid:48) , t , x , x , x , x , x , x , t , t , t , t } . This is because ( τ, , ( σ, ∈ L ( t , x (cid:48) ), andhence, G (cid:48) is not extended to the vertices { x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , t (cid:48) , t (cid:48) , t (cid:48) , t (cid:48) } . The list of the vertices in thenew instance ( L (cid:48) lists) are as follows. L (cid:48) ( x (cid:48) ) = { } , L (cid:48) ( t ) = { σ } , L (cid:48) ( t ) = { σ, γ } , L (cid:48) ( t ) = { σ, γ } , L (cid:48) ( x ) = { } , L (cid:48) ( x ) = L (cid:48) ( x ) = L (cid:48) ( x ) = L (cid:48) ( x ) = L (cid:48) ( x ) = { , } , and L (cid:48) ( t ) = L (cid:48) ( t ) = { α, β, γ, σ } (See Figure 6). 13 x x x x t t t t x βσαγ
01 0 10 αβγσ γσ γσt σ x (cid:48) L (cid:48) lists Figure 6:
Applying Sym-Diff function on
G, L, t , α, τ, x (cid:48) , L (cid:48) Now suppose we want to solve the instance G (cid:48) , L (cid:48) . At this point one could say this instanceis Minority and according to Algorithm 2 we should call a Maltsev algorithm. However, we mayfurther apply Algorithm 2 on instances constructed in Sym-Diff and use the ”no” output todecide whether there exists a homomorphism or not. Now consider
Sym-Diff ( G (cid:48) , L (cid:48) , t , α, β, x , G (cid:48)(cid:48) = { x , x , x , x , x , x } and lists L (cid:48)(cid:48) as follows. L (cid:48)(cid:48) ( t ) = { α } , L (cid:48)(cid:48) ( x ) = { } . By following Q from t to x we would have L (cid:48)(cid:48) ( x ) = { } (because(0 , α ) (cid:54)∈ L (cid:48) ( x , t )), and then following Q to t we would have L (cid:48)(cid:48) ( t ) = { γ } (because (1 , σ ) (cid:54)∈ L (cid:48) ( x , t )). By similar reasoning and following Q from t to x we have L (cid:48)(cid:48) ( x ) = { } , andconsequently from x to t alongside Q we have L (cid:48)(cid:48) ( t ) = { α, γ } . By following Q from t to x we would have L (cid:48)(cid:48) ( x ) = { } , and consequently L (cid:48)(cid:48) ( t ) = { γ } . By following Q from t to x wehave L (cid:48)(cid:48) ( x ) = { } , and continuing along Q to t we would have L (cid:48)(cid:48) ( t ) = { γ } .14 x x x x t t t t x αγ α γ γL (cid:48)(cid:48) lists t σ x (cid:48) Figure 7:
Applying Sym-Diff function on G (cid:48) , L (cid:48) , t , α, β, x , Finally we see the pair lists L (cid:48)(cid:48) ( x , x ) = ∅ because (0 , (cid:54)∈ L (cid:48)(cid:48) ( x , x ). Therefore, there is no L (cid:48)(cid:48) -homomorphism from G (cid:48)(cid:48) to H . This means in the algorithm we remove ( α,
0) from L (cid:48) ( t , x ).Moreover, L (cid:48) ( α, (cid:54)∈ L (cid:48) ( t , x ) and hence α is removed from L (cid:48)(cid:48) ( t ). Similarly we conclude thatthere is no homomorphism for the instance Sym-Diff ( G (cid:48) , L (cid:48) , t , β, α, x , β from L (cid:48) ( t ).Again suppose we call, Sym-Diff ( G (cid:48) , L (cid:48) , t , γ, σ, x , D with vertexset { x , x , x , x , x , x } and lists L as follows. L ( t ) = { α } , L ( x ) = { } , L ( x ) = { } , L ( t ) = { σ } , L ( x ) = { } . L ( x ) = { } , L ( t ) = { γ } , L ( x ) = { } , and L ( t ) = { β } . Nowwe see the pairs lists L ( t , x ) = ∅ because ( β, (cid:54)∈ L (cid:48) ( t , x ). Therefore, we conclude γ should beremoved from L (cid:48) ( t ). By similar argument, we conclude that σ is removed from L (cid:48) ( t ).In conclusion, there is no L -homomorphism that maps x to 1. By symmetry we conclude thatthere is no L -homomorphims that maps x to zero. This means L ( x ) = L ( x ) = L ( x ) = L ( x ) = L ( x ) = L ( x ) = { } . L ( t ) = L ( t ) = L ( t ) = L ( t ) = { τ } . So any homomorphism φ from G to H maps x i , 1 ≤ i ≤ t i , 1 ≤ i ≤ τ .It is easy to verify that φ may map all the vertices x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) to 2, and there also existsa homomorphism φ (cid:48) where the image of x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) , x (cid:48) is in { , } . Generalization
Let R be a relation of arity k on set A , and suppose R admits a weak NUpolymorphism φ of arity 3 (for simplicity). Let α , α , . . . , α m be the tuples in R . Let a , a , . . . , a n be the elements of A . Let α j = ( c , c , . . . , c k ) be the j -tuple, 1 ≤ j ≤ m of R . Let P i,j be anoriented path that is constructed by concatenating k + 2 smaller pieces (oriented path) where eachpiece is either a forward arc or a forward-backward-forward arc. The first piece of P i,j is a forward15rc and the k + 2-piece is also a forward arc. The r -th piece, 2 ≤ r ≤ k , is a forward arc if a i = c r ,otherwise, the r -th piece is a forward-backward-forward arc; and in this case we say the r -th piecehas two internal vertices. Note that ( r + 1)-the piece is attached to the end of the r -th piece. Forexample, if a = 0 and α = (0 , , , ,
0) then P , looks like :Figure 8: The oriented path corresponding to (0 , , , , H is constructed as follows. V ( H ) consists of b , b , . . . , b n corresponding to a , a , . . . , a n ,together with vertices β , β , . . . , β m corresponding to α , α , . . . , α m . For every 1 ≤ i ≤ n , 1 ≤ j ≤ m , we put a copy of P i,j between the vertices b i and β j ; identifying the beginning of P i,j with b i and end of P i,j with β j .Now it is easy to show that the resulting digraph H is a balanced digraph and admits aweak NU polymorphism. For every triple ( b i , b j , b (cid:96) ) from b , b , . . . , b n set ψ ( b i , b j , b (cid:96) ) = b s where a s = φ ( a i , a j , a (cid:96) ). For every β i , β j , β (cid:96) from { β , β , . . . , β m } , set ψ ( β i , β j , β (cid:96) ) = β s where α s = φ ( α i , α j , α (cid:96) ) where φ is applied coordinate wise on ( α i , α j , α (cid:96) ). We give level to the vertices of H .All the vertices, b , b , . . . , b n gets level zero. If uv is an arc of H then level ( v ) = 1 + level ( u ). Allthe β , β , . . . , β m vertices gets level k + 2. For every a, b, c ∈ V ( H ), set ψ ( a, b, c ) = a when a, b, c are not on the same level of H . Otherwise, for a ∈ P i,i (cid:48) and b ∈ P j,j (cid:48) , and c ∈ P (cid:96),(cid:96) (cid:48) where all onlevel h of H , set ψ ( a, b, c ) = d where d has the following properties: • d is a vertex on the same level as a, b, c , • d lies on P s,s (cid:48) where φ ( a i , a j , a (cid:96) ) = a s and φ ( α i (cid:48) , α j (cid:48) , α (cid:96) (cid:48) ) = α s (cid:48) , • if any of the a ∈ P i,i (cid:48) , b ∈ P j,j (cid:48) , and c ∈ P (cid:96),(cid:96) (cid:48) is an interval vertex (reffering to the r-th pieceof P ) then d is also an interval vertex of P s,s (cid:48) when exists. Otherwise d should not be aninternal. • if i = j = (cid:96) and i (cid:48) = j (cid:48) = (cid:96) (cid:48) , then ψ ( a, b, c ) = a if a = b or a = c , otherwise, ψ ( a, b, c ) = b (i.e.,the majority function).Suppose aa (cid:48) , bb (cid:48) , cc (cid:48) are arcs of H . By the following observation, it is easy to see that ψ ( a, b, c ) ψ ( a (cid:48) , b (cid:48) , c (cid:48) )is an arc of H . Observation.
Suppose a, b, c are at the beginning (end) of the r -th piece of P i,i (cid:48) and b ∈ P j,j (cid:48) , and c ∈ P (cid:96),(cid:96) (cid:48) (respectively) and none of these three pieces has an interval vertex. Then, the r -th pieceof P s,s (cid:48) does not an interval vertex.By definition a i appears in the r -th coordinate of α i (cid:48) , and a j appear in the r -th coordinate of α j (cid:48) , and a (cid:96) appears in the r -th coordinate of α (cid:96) (cid:48) . Since φ is applied coordinate wise on ( α i (cid:48) , α j (cid:48) , α (cid:96) (cid:48) ),the r -th coordinate of α s (cid:48) is φ ( a i , a j , a (cid:96) ) = a s , and hence, the r -th coordinate of α s (cid:48) is a s . Therefore,the r -th piece of P s,s (cid:48) doesn’t have an interval vertex. By Lemma 4.3, we preserve the existence of a homomorphism from G to H after Algorithm. Weobserve that the running time of PreProcessing function is O ( | G | | H | ). According to the proof of16emma 4.3 (2) the running time of Algorithm 2 is O ( | G | | H | k +4 ). Therefore, the running time ofthe Algorithm 1 is O ( | G | | H | k +4 ). We first show that the standard properties of consistency checking remain true in our setting –namely, that if the Preprocessing algorithm succeeds then f remains a homomorphism consistentwith the lists L if it was before the Preprocessing. Lemma 4.1 If f is a homomorphism of G × H k → H consistent with L then f is a homomorphismconsistent with L after running the Preprocessing. Proof:
We need to show that if a , a , . . . , a k are in L ( y ) after the Preprocessing then f ( y ; a , a , . . . , a k ) ∈ L ( y ) after the Preprocessing. By definition vertex a is in L ( y ) after the Pre-processing because for every oriented path Y (of some length m ) in G from y to a fixed vertex z ∈ V ( G ) there is a vertex a (cid:48) ∈ L ( z ) and there exists a walk B in H from a to a (cid:48) and con-gruent with Y that lies in L ( Y ); list of the vertices of Y . Let a (cid:48) , a (cid:48) , a (cid:48) , . . . , a (cid:48) k ∈ L ( z ). Let A i ,1 ≤ i ≤ k be a walk from a i to a (cid:48) i in L ( Y ) and congruent to Y . Let A i = a i , a i , a i , . . . , a mi , a (cid:48) i andlet Y = y, y , y , . . . , y m , z . Since f is a homomorphism consistent with L before the Preprocessing, f ( y ; a , a , . . . , a k ) , f ( y ; a , a , . . . , a k ) , . . . , f ( y i ; a i , a i , . . . , a ik ) , . . . , f ( y m ; a m , a m , . . . , a mk ) ,f ( z ; a (cid:48) , a (cid:48) , . . . , a (cid:48) k ) is a walk congruent with Y . This would imply that there is a walk from f ( y ; a , a , . . . , a k ) to f ( z ; a (cid:48) , a (cid:48) , . . . , a (cid:48) k ) congruent with Y in L ( Y ), and hence, f ( y ; a , a , . . . , a k ) ∈ L ( y ). (cid:5) By a similar argument as in the proof of Lemma 4.1 we have the following lemma.
Lemma 4.2 If f is a homomorphism of G × H k → H , consistent with L and ( a i , b i ) ∈ L ( x, y ) , ≤ i ≤ k , after Preprocessing then ( f ( x ; a , a , . . . , a k ) , f ( y ; b , b , . . . , b k )) ∈ L ( x, y ) after thePreprocessing. The main argument is proving that after
Not-Minority algorithm ( Algorithm 2), there stillexists a homomorphism from G to H if there was one before Not-Minority . Lemma 4.3 If ( d , e ) ∈ L ( y, z ) after calling Not-Minority ( G , H, L , f ) where ( G , L ) = Sym-Diff ( G, L, y, d , d , z, e ), then set test = true , otherwise, set test = f alse . If ( d , e ) ∈ L ( y, z ) after calling Not-Minority ( G , H, L , f ) where ( G , L ) = Sym-Diff ( G, L, y, d , d , z, e ),then set test = true , otherwise, set test = f alse . Then the following hold. α. If test is false then there is no homomorphism from G to H that maps y to d and z to e . β. If test is false then there is no homomorphism from G to H that maps y to d and z to e . γ. If both test , test are true then there exists an L -homomorphism from G = G to H , thatmaps y to d and z to e where f ( y ; d k , d ) = d (cid:54) = d . Moreover, Not-Minority returns an L (cid:48) - homomorphism from G (cid:48) to H where ( G (cid:48) , L (cid:48) ) = Sym-Diff ( G, L, y, d, d , z, e ). . Suppose both test , test are true, and f ( y ; d k , d ) = d (cid:54) = d . Suppose there exists a homo-morphism g from G to H with g ( y ) = d and g ( z ) = e . Then there exists a homomorphism h from G to H with h ( y ) = d and h ( z ) = e . Proof:
We use induction on the (cid:80) x ∈ V ( G ) | L ( x ) | . The base case of the induction is when all thelists are singleton, or when all the pairs are minority. If the lists are singleton then at the beginningof Not-Minority algorithm we check whether the singleton lists form a homomorphism from G to H . If all the pairs are minority ( f ( x, a k , a ) = a for every x ∈ V ( G ), a , a ∈ L ( x )) then thefunction RemoveMinority inside
Not-Minority algorithm, correctly returns a homomorphismfrom G to H if there exists one (see lines 6–8 of Algorithm RemoveMinority G , L constructed by Sym-Diff ( G, L, y, d , d , z, e ) in which L ( y ) = { d } and L ( z ) = { e } . Proof of ( α ) We first notice that f is closed under L . Let v ∈ G and suppose c , c , . . . , c k ∈ L ( v ). Thus, we have ( c , d ) , ( c , d ) , . . . , ( c k , d ) ∈ L ( v, y ), and ( c , e ) , ( c , e ) , . . . , ( c k , e ) ∈ L ( v, z ). Let P = v, v , v , . . . , v t , y (or z ) be an arbitrary oriented path from v to y ( z ) in G . Now c = f ( v ; c , c , . . . , c k ) , f ( v ; c , c , . . . , c k ) , . . . , f ( v t ; c t , c t , . . . , c tk ) , f ( y ; d , d , . . . , d ) = d where c i , c i , . . . , c ik ∈ L ( v i ), 1 ≤ i ≤ t , implies a path from c to d , and hence, there exists an orientedpath from c to d in L ( P ) and congruent to P . This would mean c ∈ L ( v ), according to Sym-Diff construction. Observe that G is an induced sub-digraph of G , and (cid:80) x ∈ V ( G ) | L ( x ) | < (cid:80) x ∈ V ( G ) | L ( x ) | . Thus, by induction hypothesis (assuming Not-Minority returns the right answeron smaller instance) for instance G , L , H, f , there is no homomorphism from G to H that maps, y to d and z to e .For contradiction, suppose there exists an L -homomorphism g from G to H (with g ( y ) = d , g ( z ) = e ). Then, for every vertex v ∈ V ( G ) we have g ( v ) ∈ L ( v ), and ( g ( v ) , d ) ∈ L ( v, y ), and( g ( v ) , e ) ∈ L ( v, z ). On the other hand, by the construction in function Sym-Diff , L ( v ) containsevery element i ∈ L ( v ) when ( i, d ) ∈ L ( v, y ) and ( i, e ) ∈ L ( v, z ), and consequently g ( v ) ∈ L ( v ).However, g : G → H , with g ( u ) = g ( u ) for every u ∈ V ( G ) is a homomorphism, a contradictionto nonexistence of such a homomrphism.Notice that ( d , i ) ∈ L ( y, v ) and ( e , i ) ∈ L ( z, v ), in the first call to Sym-Diff . But, if at someearlier call to
Sym-Diff , we removed ( d , i ) from L ( y, v ) then by induction hypothesis this decisionwas a right decision, and hence, i (cid:54) = g ( v ), and consequently is not used for g . Proof of ( β ) is analogous to proof of ( α ). Proof of ( γ ) Suppose test , test are true. Let g be the homomorphism returned by Not-Minority function for the instance G , H, L , f , and g be the homomorphism returned by Not-Minority function for instance G , H, L , f . (i.e. from Sym-Diff ( G, L, y, d , d , z, e )). By defini-tion G = G . Let G (cid:48) be the digraph constructed in Sym-Diff ( G, L, y, d, d , z, e ). Notice that G (cid:48) isan induced sub-digraph of G . This is because when z is in B ( G ) then there exists some r ∈ L ( v )such that ( d , r ) , ( d , r ) ∈ L ( y, v ), and since f is closed under L , we have ( f ( v, d k , d ) , r ) ∈ L ( y, v ).Therefore, v is either inside B ( G (cid:48) ) or v ∈ V ( G ) \ V ( G (cid:48) ); meaning that G (cid:48) does not expand beyond B ( G ), and hence, G (cid:48) is an induced sub-digraph of G .Now for every vertex y ∈ V ( G (cid:48) ), set g ( y ) = f ( y ; g k ( y ) , g ( y )). Since g , g are also L -homomorphism from G = G to H and f is a polymorphism, it is easy to see that g is an L -homomorphism from G to H , and hence, also an L - homomorphism from G (cid:48) to H .18 roof of ( λ ) Suppose there exists an L -homomorphism g : G → H with g ( y ) = d , g ( z ) = e .Then we show that there exists an L -homomorphism h : G → H with h ( y ) = d , h ( z ) = e . Remark:
The structure of the proof is as follows. In order to prove the statement of the Lemma4.3( λ ) we use Claim 4.4. The proof of Claim 4.4 is based on the induction on the size of the lists.Let g be an L -homomorphism from G to H with g ( y ) = d and g ( z ) = e , and g be an L -homomorphism from G to H with g ( y ) = d , and g ( z ) = e . According to γ , there exists an L -homomorphism g = g y,zd,e form G (cid:48) = G = G to H , that maps y to d and z to e . As arguedin the proof of γ , g is constructed based on g , g and polymorphism f . We also assume that g agrees with g in G .If G (cid:48) = G , then we return the homomorphism g as the desired homomorphism. Otherwise,consider a vertex z which is on the boundary of G (cid:48) , B ( G (cid:48) ). Recall that B ( G (cid:48) ) is the set of vertices u ∈ V ( G ) with some i ∈ L z,e ( u ), such that ( i, d ) , ( i, d ) ∈ L z,e ( u, y ). Let P be an oriented pathin G (cid:48) ∪ B ( G (cid:48) ) from y to z , and let P be an oriented path in G (cid:48) ∪ B ( G (cid:48) ) from y to z . We mayassume P and P meet at some vertex v ( v could be y , see Figure 9). We may assume z is chosensuch that (cid:96) = g ( z ), and g ( v ) (cid:96) (cid:54)∈ A ( H ) ( (cid:96) g ( v ) (cid:54)∈ A ( H )) where v is last vertex before z on P , and v z ∈ A ( G ) ( z v ∈ A ( G )) ( g ( v ) must have a neighbor inside L ( z ) because of thePreprocessing). Notice that if g ( v ) (cid:96) ∈ A ( G ) for every such path P then we can extend g to z as well. Moreover, if there is no such z then we can extend g to B ( G (cid:48) ), and define h ( y ) = g ( y )for every y ∈ V ( G (cid:48) ), and h ( y ) = g ( y ) for every y ∈ V ( G ) \ V ( G (cid:48) ). It is easy to see that h is anL-homomorphism from G to H with h ( y ) = d . Thus, we proceed by assuming the existence of such z . Let L = L y,d ,z,e , and L = L y,d ,z,e . Now we look at G (cid:48) , and the aim is the following. • First, modify g on the boundary vertices, B ( G (cid:48) ), so that the image of every z i ∈ B ( G (cid:48) ), g ( z i ) ∈ L y,d,z,e ( z i ), i.e. ( d, g ( z i )) ∈ L ( y, z i ). • Second, having a homomorphism g (i.e. g ( y ) = d , g ( z ) = e ) from G (cid:48) ∪ B ( G (cid:48) ) to H thatagrees with g on B ( G (cid:48) ).Maybe the second goal is not possible on B ( G (cid:48) ), and hence, we look beyond B ( G (cid:48) ) and look fordifferences between g and g inside an induced sub-digraph of G containing G (cid:48) . We construct thenext part of homomorphism h using g and homomrphism g (cid:48) ( obtained from g , g z i ,z(cid:96) i ,e for some (cid:96) i ∈ L ( z i )), and homomorphism f . Let b = g ( v ) and let b = g ( v ), and b = f ( v ; b k , b ). Let (cid:96) = g ( z ), and (cid:96) (cid:48) ∈ L ( z ) such that g ( v ) (cid:96) (cid:48) ∈ A ( H ) (recall that v z is the last arc on P ; thepath from y to z ). First scenario.
There exists (cid:96) (cid:48) ∈ L ( z ) ∩ L ( z ) such that ( b , (cid:96) (cid:48) ) , ( b , (cid:96) (cid:48) ) ∈ L ( v, z ) (see Figure9). Note that since g is a homomorphism, we have ( d , b ) ∈ L ( y, v ) and ( b , e ) ∈ L ( v, z ). Set e = f ( z ; ( (cid:96) (cid:48) ) k , (cid:96) ) . Case 1.
Suppose e (cid:54) = (cid:96) . Let P [ v, z ] = v, v , v , . . . , v t , z , and let walk b , c , c , . . . , c t , (cid:96) (cid:48) ,and walk b , d , . . . , d t , (cid:96) be inside L ( P [ v, z ]) and congruent with it. Observe that the walk f ( v, b k , b ) , f ( v , c k , d ) , . . . , f ( v t , c kt , d t ) , f ( z , ( (cid:96) (cid:48) ) k , (cid:96) ) inside L ( P [ v, z ]) is from b = f ( v, b k , b ) to e . Therefore, ( b, e ) ∈ L ( v, z ) (Figure 9), and consequently ( d, e ) ∈ L ( y, z ).19 (cid:96) (cid:96) (cid:48) y zz v In G In lists b b b e d d d Figure 9: z ∈ B ( G (cid:48) ), and (cid:96) , (cid:96) (cid:48) ∈ L z,e ( z ), ( b , (cid:96) (cid:48) ) ∈ L z,e ,y,d ( v, z ), . Thus, there is a walk from b = f ( v ; b k , b ) to e = f ( z ; (cid:96) (cid:48) k , (cid:96) ) in L ( P [ v, z ]) Case 2.
Suppose e = (cid:96) . Note that in this case again by following the oriented path P [ v, z ]and applying the polymorphism f in L ( P ), we conclude that there exists a walk from b to e in L ( P [ v, z ]), congruent to P [ v, z ], and hence, ( b, (cid:96) ) ∈ L ( v, z ) and consequently ( d, e ) ∈ L ( y, z )Since G, L is smaller than the original instance, by Claim 4.4, the small tests pass for G, L ,and hence, by induction hypothesis, we may assume that there exists another L -homomorphismfrom G to H that maps y to d and z to e , and z to e . Thus, for the sake of less notationswe may assume g is such a homomorphism. This means we may reduce the lists L by identifying (cid:96) and e when e (cid:54) = (cid:96) in L ( z ), and hence, we restrict the lists L to L ( z , e ). Observe thataccording to Cases 1,2, ( d, e ) ∈ L ( y, z ).We continue this procedure as follows: Let z be the next vertex in B ( G (cid:48) ) with g ( z ) = (cid:96) . Againif the First scenario occurs, meaning that there exists (cid:96) (cid:48) ∈ L ( z ) such that ( b , (cid:96) (cid:48) ) ∈ L ( v, z ) and( b , (cid:96) (cid:48) ) ∈ L ( v, z ) then we continue as follows. Let e = f ( z ; ( (cid:96) (cid:48) ) k , (cid:96) ) (see Figure 10). (cid:96) (cid:48) y z v In G In lists b b b e d d d z (cid:96) (cid:48) (cid:96) e Figure 10: z ∈ B ( G (cid:48) ), and (cid:96) , (cid:96) (cid:48) ∈ L z,e ( z ) where (cid:96) = g ( z ). There is a walk from b to e = f ( z ; ( (cid:96) (cid:48) ) k , (cid:96) ) e = (cid:96) then we have ( b, (cid:96) ) ∈ L ( v, z ) (this is because of the definition of the polymorphism f ), and hence, as in Case 2 we don’t modify g . Otherwise, we proceed as in Case 1. In otherwords, we may assume that there exists an L -homomorphism from G to H that maps y to d , z to e and z to e , and z to e . We may assume g is such a homomorphism. Again this means wefurther restrict g on the boundary vertices of G (cid:48) ; B ( G (cid:48) ), so they are simultaneously reachable from b . If all the vertices in B ( G (cid:48) ) fit into the First scenario then we return homomorphism h from G to H where inside G (cid:48) , h agrees with g and outside G (cid:48) , h agrees with g . Otherwise, we go on to theSecond scenario. Second scenario.
There is no (cid:96) (cid:48) ∈ L ( z ) ∩ L ( z ) such that ( b , (cid:96) (cid:48) ) , ( b , (cid:96) (cid:48) ) ∈ L ( v, z ) (seeFigure 11). At this point we need to start from vertex v, b , b , b ∈ L ( v ). We consider the digraph( G , L ) = Sym-Diff ( G, L , v, b , b , z, e ) and follow homomrphism g inside G , by considering B ( G ), and further modifying g so that its images are reachable from b simultaneously. For example,let (cid:96) = g ( z ), (cid:96) (cid:48) ∈ L ( z ) with g ( v ) (cid:96) (cid:48) ∈ A ( H ), where v z is the last arc of P , and b (cid:48) ∈ L ( z )with b (cid:48) = f ( z ; ( (cid:96) (cid:48) ) k , (cid:96) ). Notice that here we may g is an L -homomorphism obtained by calling Not-Minority ( G , H, L , f ). This homomorphism should exist because of Claim 4.4 for L . e (cid:96) (cid:96) (cid:48) y zz v In G In lists b b bd d d b (cid:48) a (cid:48) a a w Figure 11: z ∈ B ( G (cid:48) ), and (cid:96) , (cid:96) (cid:48) ∈ L z,e ( z ). There is a walk from b to b (cid:48) = f ( z ; ( (cid:96) (cid:48) ) k , (cid:96) )Now as depicted in Figure 11, let w be a vertex in B ( G ), and suppose there exists a (cid:48) ∈ L ( w ) ∩ L ( w ) such that ( (cid:96) , a (cid:48) ) ∈ L ( z , w ) and ( (cid:96) (cid:48) , a (cid:48) ) ∈ L ( z , w ). Let a = g ( w ). Now asin Case 1,2, we conclude that there exists a path from b (cid:48) to a = f ( w ; ( a (cid:48) ) k , a ), and hence, wecan further modify g so that its image on w is a . If there is no such a (cid:48) then we will be back inthe Second scenario.This process goes on as long as for all the boundary vertices the first scenario occur or we mayreach to entire G . In any case, we would have a homomorphism that maps y to d and z to e . Claim 4.4
Suppose all the small tests pass for instance ( G, L, H ) . Let x be an arbitrary vertexof G and let c ∈ L ( x ) . Let L = L x ,c . Then all the small tests pass for G, L . Proof:
Let G be the sub-digraph constructed in Sym-Diff ( G, L, y, d , d , x , c ). Note that thereexists, an L -homomorphism, g : G → H with g ( x ) = c , g ( y ) = d . Let L = ( L ) y,d , andlet L = ( L ) x ,c . The goal is to build a homomorphism ψ , piece by piece, that maps x to c ,21 to c , and y to d where its image lies in L . In order to to that we use induction on the sizeof (cid:80) z ∈ V ( G ) | L ( z ) | . First suppose there exists x on the oriented path from x to y , and let a , a ∈ L ( x ) so that any oriented path from a ∈ L ( x ) inside L ( Y [ x , x ]) ends at c . Since d (cid:54) = d , it is easy to assume that a (cid:54) = a . Now consider the sub-digraph, G constructed in Sym-Diff ( G, L , x , a , a , x , c ) ( a , a ∈ L ( x )) and let g be a homomorphism from G to H . Wemay assume g ( y ) = d (cid:48) (cid:54) = d (see Figure 12). The other case; d (cid:48) = d , is a special case of d (cid:48) (cid:54) = d .Notice that by the choice of x , g ( x ) = c . Thus, ( c , d (cid:48) ) ∈ L ( x , y ). Let L (cid:48) = ( L ) x ,c ,x ,a x y z c d d g shown by green L x ,c shown by blue x c e In G In H and lists x a a d (cid:48) z b b Figure 12:
Proof of Claim 4.4 and notice that d ∈ L (cid:48) ( y ). The total size of all the lists of L (cid:48) is less than the total size of thelists in L because L (cid:48) ( x ) = { a } . Thus, by induction hypothesis for the lists L (cid:48) we may assumethat all the tests inside L (cid:48) pass, and hence, there exists an L (cid:48) , homomorphism g (cid:48) from G (cid:48) to H ,in which g (cid:48) ( y ) = d . Here G (cid:48) is the sub-digraph constructed in Sym-Diff ( G, L , y, d , d (cid:48) , x , a ).Notice that x is in B ( G (cid:48) ). Case 1.
There exists a vertex of z ∈ B ( G ) ∩ V ( G (cid:48) ) (see Figure 12). In this case, the homomor-phism ψ agrees with g (cid:48) on the path Z from y to z ∈ B ( G (cid:48) ) (where z is also a vertex in B ( G ))that goes through vertex z . x y z c d d g shown by green L x ,c shown by blue x c e In G In H and lists x a a d (cid:48) z e b b Figure 13: The homomorphism on G (cid:48) shown by green color Case 2.
There exists a vertex of z ∈ B ( G (cid:48) ), z ∈ V ( G ) \ B ( G ) (see Figure 13). Let22 (cid:48) ( z ) = b . Let b ∈ ( L ) x,c ,y,d ( z ). Now we consider the sub-digraph G constructed in Sym-Diff ( G, L , z , b , b , z, e ) where z is a vertex in B ( G ). There exists, a homomorphism g from G to H . We need to obtain g (cid:48) (using g and induction hypothesis) so that its image on some partof G ∩ ( G ∩ G ) lies inside L , and then ψ would follow g (cid:48) on that part. To do so, we end withone of the cases 1, 2. If case 2 occurs we need to continue considering other partial homomorphisms.Now consider the case where x does not exist, in other words, x is a vertex neighbor to x ,and consider a ∈ L ( x ). In this case c is adjacent to a , and we can extend the homomorphism g to vertex x where g ( x ) = c . (cid:5) Lemma 4.5
The running time of the algorithm is O ( | G | | H | k +4 ) (here | G | is the number of arcsplus the number of vertices of G ). Proof:
At the first glance, the algorithm 2 looks exponential because we make polynomially manyrecursive calls. However, it is easy to see that the depth of the recursion is at most | H | . This isbased according to the construction of ( G (cid:48) , L (cid:48) ) = Sym-Diff ( G, L, y, d , d , z, e ); for each v ∈ V ( G (cid:48) ), | L (cid:48) ( v ) | < | L ( v ) | . This simply would guarantee that the running time of the algorithm is of | G | O ( | H | ) .However, it is more than just that, as the list becomes disjoint. Our implementation of algorithmwould also support that the algorithm would perform much faster than | G | O ( | H | ) .According to Observation 2.5, we consider each connected component of G × L H separately.The connected component partitioned the G × L H , and hence, the overall running time would bethe sum of the running time of each connected components. We go through all the pairs and lookfor not-minority ones, which takes O ( | G || H | k ) because we search for each k -tuple inside the list ofeach vertex v of G . We also observe that the running time of the Preprocessing is O ( | G | | H | ).Note that at the end, we need to apply RemoveMinority algorithm which we assume there existsone with running time O ( | G | | H | ) (see [10]).Now suppose Algorithm 2 starts calling function Sym-Diff where it considers two distinct ver-tices y, z ∈ V ( G ) and e ∈ L ( z ), d , d ∈ L ( y ). The constructed instances are T = ( G , L ) = Sym-Diff ( G, L, y, d , d , z, e ) and T = ( G , L ) = Sym-Diff ( G, L, y, d , d , z, e ). The lists L , L (respectively) are disjoint because we exclude the boundary vertices into G , G . Therefore, therunning time of T ( T ) is a polynomial of O ( poly ( | G | ) ∗ poly ( | L | )) ( O ( poly ( | G | ) ∗ poly ( | L | ))then the overall running time would be O ( poly ( | G | ) ∗ poly ( | L | )) for G and L . Here | L | denote themaximum size of a list and notice that | L | ≤ | V ( H ) | .Let e , e , . . . , e t ∈ L ( z ) and d , d , . . . , d r ∈ L ( y ) such that they induce a bi-clique in L . Wemay assume there exists at least one pair d , d which is not minority. According to function Bi-Clique-Instances instead of ( d , e ) we use only ( d, e ) where d = f ( y ; d k , d ) and continuemaking the pair lists L × L smaller. Eventually each Bi-clique turns to a single path or the instancebecomes Minority instance. Therefore, this step of the algorithm is a polynomial process with aoverall running time O ( | G | | H | k +1 ) because we need to consider each pair of vertices of G andfind a bi-clique. This means the degree of the poly is three and the degree of poly is k + 1 (wehave of order | G | from Preprocessing or from RemoveMinority algorithm, and of order | H | k +1 for finding bi-cliques). Therefore, the entire algorithm runs in O ( | G | | H | k +4 ). This is because weconsider every pair x, y , and d , d ∈ L ( y ), and e ∈ L ( z ). (cid:5) Weak near unanimity recognition algorithm
Let A be a finite set. By a k -ary relation R on set A we mean a subset of the k -th cartesian power A k ; k is said to be the arity of the relation. A constraint language (relational structure) Γ over A is a set of relations over A . A constraint language is finite if it contains finitely many relations.A hypergraph G on set X , consists of a set of hyperedges where each hyperedge e is an ordered tuple ( x , x , . . . , x k ) , x , x , . . . , x k ∈ X . Here k is called the size of the hyperedge e . Notice thatdifferent hyperedges could have different sizes. A hypergraph is called uniform if all its hyperedgeshave the same size. We denote the vertices of the hypergraph G by V ( G ).For two hypergraphs G , H , a homomorphism f : G → H , is a mapping from V ( G ) to V ( H ) suchthat for every hyperedge ( x , x , . . . , x k ) ∈ G , ( f ( x ) , f ( x ) , . . . , f ( x k )) is an hyperedge in H .An instance of the constraint satisfaction problem (CSP) can be viewed as an instance of thehypergraph list homomorphism problem. We are given two hypergraphs G , H together with lists L where each hyperedge α ∈ G has a list of possible hyperedges (all with the same size as α )in H , denoted by L ( α ). The goal is to find a homomorphism f : G → H such that for everyhyperedge α = ( x , x , . . . , x k ) ∈ G , ( f ( x ) , f ( x ) , . . . , f ( x k )) ∈ L ( α ). In other words, if we look atthe vertices of G as variables, the vertices of H as values, and hyperedges α (cid:48) s ∈ G as constraintsthen the existence of homomorphism f illuminates a way of giving each variable a value, so thatall constraints are satisfied simultaneously. A constraint is of form ( α, L ( α )), and a constraint issatisfied if tuple α is mapped by f into one of the tuples in its list. Definition 5.1 (Signature)
For every two hyperedges α , α from G ( or H ) we associate a sig-nature S α ,α = { ( i, j ) | α [ i ] = α [ j ] } ( α [ i ] is the element in coordinate i -th of α ). Let H be a hypergraph on set A . Let H , H , . . . , H t be a partition of H into t uniform hyper-graphs. A mapping h : A r → A is a polymorphism of arity r on H if h is closed under each H i ,1 ≤ i ≤ t . In other words, for every r hyperedges τ , τ , . . . , τ r ∈ H i , h ( τ , τ , . . . , τ r ) ∈ H i . Noticethat here h is applied coordinate wise (e.g. if ( a , a , a ) , ( b , b , b ) , ( c , c , c ) are hyperedges in H i then ( h ( a , b , c ) , h ( a , b , c ) , h ( a , b , c )) is a hyperedge in H i ).In order to prove Theorem 1.2 it is enough to prove the following theorem. Theorem 5.2
Let H be a hypergraph. Then the problem of deciding whether H admits a weak NUpolymorphism is polynomial time solvable. The proof of the Theorem 5.2 consists of several lemmas and an algorithm as follows. Let H , . . . , H t be a partitioned of H into uniform hypergraphs. We construct graph G, H and lists L . Vertices of
G, H and lists L : The vertices of G are four tuples x = ( α, β, γ, λ ) where α, β, γ, λ ∈H l , 1 ≤ l ≤ t . The vertices of H are τ where τ is a hyperedge of H . For x = ( α, β, γ, λ ), L ( x ),consists of all τ , τ ∈ H l with the following property: • If α [ i ] = β [ j ] = λ [ i ], α [ j ] = γ [ j ] = β [ i ], and γ [ i ] = λ [ j ] then τ [ i ] = τ [ j ]. Adjacency in G : Two vertices x = ( α, β, γ, λ ), and y = ( α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ) from G with α, β, γ, λ ∈ H l , α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ∈ H l (cid:48) are adjacent if at least one of the following occurs.24 S α,α (cid:48) ∩ S β,β (cid:48) ∩ S γ,γ (cid:48) ∩ S λ,λ (cid:48) (cid:54) = ∅ . • α [ i ] = β (cid:48) [ j ] = λ [ i ], α (cid:48) [ j ] = γ (cid:48) [ j ] = β [ i ], and γ [ i ] = λ (cid:48) [ j ] Adjacency in H : Two vertices τ ∈ L ( x ) and ω ∈ L ( y ) in H where x = ( α, β, γ, λ ), and y =( α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ) are adjacent if the following occurs : • S α,α (cid:48) ∩ S β,β (cid:48) ∩ S γ,γ (cid:48) ∩ S λ,λ (cid:48) ⊆ S τ,ω • If α [ i ] = β (cid:48) [ j ] = λ [ i ], α (cid:48) [ j ] = γ (cid:48) [ j ] = β [ i ], and γ [ i ] = λ (cid:48) [ j ] then τ [ i ] = ω [ j ]. Lemma 5.3 H admits a Siggers polymorphism if and only if there is an L -homomorphism from G to H . Proof:
Suppose H admits a Siggers polymorphism φ . For every vertex x = ( α, β, γ, λ ) ∈ G where α, β, γ, λ ∈ H l , define mapping g : G → H with g ( x ) = φ ( α, β, γ, λ ) , where φ is applied coordinatewise. Let y = ( α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ) and suppose xy is an edge of G . By definition, τ ∈ L ( x ) where τ = φ ( α, β, γ, λ ) and ω ∈ L ( y ) where ω = φ ( α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ). Notice that if ( i, j ) ∈ S α,α (cid:48) , S β,β (cid:48) , S γ,γ (cid:48) then the value of i -th coordinate of τ is φ ( a , a , a , a ) ( a , a , a , a are the i -th coordinates of α, β, γ, λ respectively) and the value of the j -th coordinate of ω is φ ( a , a , a , a ) ( a , a , a , a arethe j -th coordinate of α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) respectively). Therefore, ( i, j ) ∈ S τ,ω , and hence, there is an edgefrom τ to ω in H . Moreover, if x , y are adjacent because α [ i ] = β (cid:48) [ j ] = λ [ i ], α (cid:48) [ j ] = γ (cid:48) [ j ] = β [ i ] thenby definition τ [ i ] = ω [ j ] and, and hence, τ , ω are adjacent in H . Therefore, g is a homomorphismfrom G to H .Conversely, suppose g is an L -homomorphism from G to H . Suppose τ = g ( x ) for x =( α, β, γ, λ ). Then, for every a , a , a , a that are the i -th coordinate of α, β, γ, λ , respectively,set φ ( a , a , a , a ) = a where a is the i -th coordinate of τ (recall τ is a ordered hyperedgecorresponding to τ = g ( x )).Consider a vertex y ∈ G with y = ( α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) ). Suppose the j -coordinate of α (cid:48) , β (cid:48) , γ (cid:48) , λ (cid:48) are a , a , a , a respectively. Let ω = g ( y ). By definition, φ ( a , a , a , a ) is a (cid:48) where a (cid:48) is the j -thcoordinate of ω . We show that a = a (cid:48) . Observe that ( i, j ) ∈ S α,α (cid:48) ∩ S β,β (cid:48) ∩ S γ,γ (cid:48) ∩ S λ,λ (cid:48) where a appears in i -th coordinate of α and in the j -th coordinate of α (cid:48) ; a is an element appearing in i -thcoordinate of β and in the j -th coordinate of β (cid:48) ; a appears in the i -th coordinate of γ and in the j -th coordinate of γ (cid:48) ; and finally a appears in the i -th coordinate of λ and in the j -th coordinateof λ (cid:48) . Therefore, x, y are adjacent in G , and since g is a homomorphism, τ and ω must be adjacentin H . By the construction of the lists, the i -th coordinate of τ is the same as the j -th coordinateof ω , i.e. a = a (cid:48) . Notice that since g is a list homomorphism, τ ∈ L ( x ) where τ = h ( α, β, γ, λ ),and hence, τ belongs to H . (cid:5) Lemma 5.4 If H admits a Siggers polymorphism then G × L H admits a Siggers list polymorphism. Lemma 5.5 If H admits a Siggers polymorphism then it also admits a weak k -NU for some k and G × L H k admits a weak k -NU list polymorphism. Proof:
It has been shown by Siggers [47] that if H admits a Sigger polymorphism it is also admita weak NU of arity k for some k ≥
3. It is easy to see that G × L H k admits a weak NU listpolymorphis when H admits a weak k -NU. (cid:5) Recall that for a, b ∈ L ( x ), we say ( a, b ) (with respect to x ) is a minority pair if f ( x ; a k , b ) = b ,otherwise, we call ( a, b ) a non-minority pair. 25 emma 5.6 Let x ∈ G , a, b ∈ L ( x ) . Suppose there exists y ∈ G , c, d ∈ L ( y ) such that ( a, c ) , ( a, d ) ∈ L ( x, y ) and ( b, d ) ∈ L ( x, y ) but ( b, c ) (cid:54)∈ L ( x, y ) . Then at least one of the ( d, c ) , ( a, b ) is not aminority pair. Proof:
By contradiction suppose, f ( y ; d k , c ) = c . Now by applying the polymorphism f on the L ( Y ), where Y is a path from x to y , we conclude that f ( x ; b, a k ) (cid:54) = b (because ( c, b ) (cid:54)∈ L ( x, y )),and hence, f ( x ; a k , b ) (cid:54) = b . (cid:5) Removing non-minority pairs
Algorithm 3 performs a test (with respect to y, z ∈ G and d , d ∈ L ( y ), e ∈ L ( z )) on a sub-digraph G (cid:48) with the lists L (cid:48) which are constructed this way.Let L = L z,e . First G (cid:48) includes vertices v of G such that for every ( d , j ) ∈ L ( y, v ) we have( d , j ) (cid:54)∈ L ( y, v ). Next, we further prune the lists L (cid:48) as follows; for each v ∈ G (cid:48) , L (cid:48) ( v ) = { i | ( d , i ) ∈ L ( y, v ) } . We ask whether there exists an L (cid:48) -homomorphism from G (cid:48) to H . If there is nosuch homomorphism then we remove ( d , e ) from the pair list ( y, z ). Algorithm 3
Finding a homomorphism from G to H Input:
G, H , lists L function Weak-NU ( G, H, L ) if ∀ x ∈ V ( G ), | L ( x ) | ≤ then ∀ x ∈ V ( G ) set g ( x ) = L ( x ) return g (cid:46) g is a homomorphism from G to H If G × L H is not connected then consider each connected component separately for all y, z ∈ V ( G ), d , d ∈ L ( y ), e ∈ L ( z ) s.t. ( d , e ) , ( d , e ) ∈ L ( y, z ) do ( G (cid:48) , L (cid:48) ) = Sym-Diff ( G, L, y, d , d , z, e ) g y,zd ,e = Weak-NU ( G (cid:48) , H, L (cid:48) ) if g y,zd ,e is empty then Remove ( d , e ) from L ( y, z ), and remove ( e , d ) from L ( z, y ) g = Getting-to-Minortiy ( G, H, L ) return g (cid:46) g is a homomorphism from G to H Input:
Digraphs G , lists L and, y, z ∈ V ( G ), d , d ∈ L ( y ), e ∈ L ( z ) function Sym-Diff ( G, L, y, d , d , z, e ) Create new lists L (cid:48) and let L = L z,e , and construct the pair lists L × L from L Set L (cid:48) ( z ) = e , L (cid:48) ( y ) = d , and set G (cid:48) = ∅ for all v ∈ V ( G ) s.t. ∀ i with ( i, d ) ∈ L ( v, y ) we have ( i, d ) (cid:54)∈ L ( v, y ) do add v (cid:48) into set G (cid:48) Let G (cid:48) be the induced sub-digraph of G for all u ∈ V ( G (cid:48) ) do L (cid:48) ( u ) = { i | ( d , i ) ∈ L ( y, u ) } for all u, v ∈ V ( G (cid:48) ) do L (cid:48) ( u, v ) = { ( a, b ) ∈ L ( u, v ) | ( a, b ) is consistent in G (cid:48) } . return ( G (cid:48) , L (cid:48) ) 26 etting into minority pairs For x ∈ G and a, b ∈ L ( x ), let G L,xa,b be the set of vertices y ∈ G such that for every i ∈ L ( y ), ( a, i ) ∈ L ( x, y ) and ( b, i ) (cid:54)∈ L ( x, y ). Let B ( G L,xa,b ) be the vertices of G outside G L,xa,b that are adjacent (via out-going, in-going arc) to a vertex in G xa,b . Making Rectangles
Suppose for a, b ∈ L ( x ), both ( a, b ) , ( b, a ) are minority pairs. We look atevery vertex y ∈ B ( G L,xa,b ) and two vertices c , c ∈ L ( y ). Suppose ( a, c ) , ( a, c ) , ( b, c ) ∈ L ( x, y ).Now by Lemma 5.6 if ( b, c ) (cid:54)∈ L ( x, y ) then ( c , c ) is not a minority pair and according to Algorithm2 (proof of correctness Lemma 4.3 ( λ )) we can remove, ( a, c ) from L ( x, y ). Therefore, as long asthere exist such y and c , c ∈ L ( y ) we continue doing so. At the end, we end up with an instance G L,xa,b ∪ B ( G L,xa,b ) in which the rectangle property preserved for x ∈ G and a, b ∈ L ( x ) and any y ∈ B ( G L,xa,b ) and c, d ∈ L ( y ). In other words, if ( a, c ) , ( b, c ) , ( a, d ) ∈ L ( x, y ) then ( b, d ) ∈ L ( x, y ). Removing other non minority pairs
Suppose for a, b ∈ L ( x ), both ( a, b ) , ( b, a ) are minoritypairs. Now for every y, z ∈ B ( G L,xa,b ) either L x,a ( y, z ) = L x,b ( y, z ) or L x,a ( y, z ) ∩ L x,b ( y, z ) = ∅ .Otherwise, according to Lemma 5.7, we would have a non minority pair ( b , b ) in L ( w ), w ∈ B ( G L,xa,b ) and we can handle such non minority pairs according to function
Clean-Up in Algorithm3 (also according Algorithm 2). The proof of correctness of the function
Clean-Up appears inLemma 5.7 (3). Suppose we have removed non minority pairs ( b , b ) with b , b ∈ L ( w ). Nowwe consider vertex y ∈ G L,xa,b , and two elements c , c ∈ L x,a ( y ). Since, ( a, c ) , ( a, c ) , ( b, c ) , ( b, c )are still in L x,a ( x, y ), ( c , c ) , ( c , c ) are still minority pairs, and hence we further consider G L x,a ,yc ,c ,and L x,a and further remove other non minority pairs. We continue this process, until we reachthe entire G , with the lists L x,a . At this point ask the RemoveMinorty ( G, H, L x,a ). If there isan answer then we have a homomorphism from G to H that maps x to a and we return such ahomomorphism. Input:
Digraphs G , lists L function Getting-to-Minority ( G, H, L ) Let x be a vertex in G with | L ( x ) | > for every two distinct a, b ∈ L ( x ) do L = L L (cid:48) = Clean-UP ( G, H, L , x, a, b ) g = RemoveMinority ( G, H, L (cid:48) ) if g (cid:54) = ∅ then return g g = Getting-to-Minortiy ( G, H, L x,a ) return g : Input:
Digraphs G , lists L , x ∈ V ( G ), a, b ∈ L ( x ) function Make-Rectangle ( G, H, L, x, a, b ) for y ∈ G , c, d ∈ L ( y ) do if ( a, c ) , ( a, d ) , ( b, d ) ∈ L ( x, y ) and ( b, c ) (cid:54)∈ L ( x, y ) then remove ( a, c ) from L ( x, y ) if ( a, c ) , ( b, c ) , ( b, d ) ∈ L ( x, y ) and ( b, d ) (cid:54)∈ L ( x, y ) then remove ( a, c ) from L ( x, y ) PreProcessing ( G, H, L ) return ( L ) Input:
Digraphs
G, H , and lists L function Clean-up ( G, H, L, x (cid:48) , a (cid:48) , b (cid:48) ) Let St be an empty Stack. push( x (cid:48) , a (cid:48) , b (cid:48) ) into St . while St is not empty do ( x, a, b ) = pop( St ) and set Visit[ x, a, b ]=true Make-Rectangle ( G, H, L, x, a, b ) for y, z ∈ B ( G L,xa,b ) do Let c, d ∈ L ( y ) and e, l ∈ L ( z ) s.t. x, a, b , y, c, d and x, a, b , z, e, l are rectangles. Let v be a vertex at the intersection of Y from x to Y and Z from x to z in G . Let a , a , a , a ∈ L ( v ) such that ( a, a ) , ( a, a ) , ( b, a ) , ( b, a ) ∈ L ( x, v ). if ( a , e ) , ( a , e ) , ( a , l ) , ( a , l ) ∈ L ( v, z ) then Let a ∈ L ( v ) s.t. ( b, a ) ∈ L ( x, v ), ( a , c ) ∈ L x,b ( v, y ) and ( a , e ) ∈ L x,b ( y, z ). if (cid:54) ∃ a ∈ L ( v ) s.t. ( a, a ) ∈ L ( x, v ), ( a , e ) ∈ L x,a ( v, z ), ( a , d ) (cid:54)∈ L x,a ( v, y ) then remove ( a, d ) , ( b, d ) from L ( x, y ) PreProcessing ( G, H, L ) if (cid:54) ∃ a ∈ L ( v ) s.t. ( b, a ) ∈ L ( x, v ), ( a , c ) ∈ L x,b ( v, y ), ( a , l ) (cid:54)∈ L x,b ( v, z ) then remove ( a, l ) , ( b, l ) from L ( x, y ) PreProcessing ( G, H, L ) if ( a , e ) , ( a , e ) , ( a , l ) , ( a , l ) ∈ L ( v, z ) then Let a ∈ L ( v ) s.t. ( a, a ) ∈ L ( x, v ), ( a , c ) ∈ L x,a ( v, y ), ( a , l ) ∈ L x,a ( y, z ). if (cid:54) ∃ a ∈ L ( v ) s.t. ( a, a ) ∈ L ( x, v ), ( a , l ) ∈ L x,a ( v, z ), ( a , d ) (cid:54)∈ L x,a ( v, y ) then remove ( a, d ) , ( b, d ) from L ( x, y ) PreProcessing ( G, H, L ) if (cid:54) ∃ a ∈ L ( v ) s.t. ( a, a ) ∈ L ( x, v ), ( a , c ) ∈ L x,a ( v, z ), ( a , l ) (cid:54)∈ L x,a ( v, y ) then remove ( a, l ) , ( b, l ) from L ( x, y ) PreProcessing ( G, H, L ) if ( a, d ) , ( a, d ) , ( b, c ) , ( b, d ) ∈ L ( x, y ) and Visit[ y, c, d ]=false then push( y, c, d ) into St if ( a, e ) , ( a, l ) , ( b, e ) , ( b, l ) ∈ L ( x, z ) and Visit[ z, e, l ]=false then push( z, e, l ) into St return ( L ) 28 eploying Maltsev algorithm Now we can deploy the procedure
RemoveMinority similarto Algorithm 1 in [38]. The goal is to eliminate one of the a, b from the list of x . We construct asub-digraph of G which is initially G (cid:48) = G L,xa,b \ B ( G L,xa,b ) in function
G-xab (similar to Algorithm 1in [38]). If there are vertices y, z ∈ B ( G L,xa,b ) so that L x,a ( y, z ) ∩ L x,b ( y, z ) = ∅ , then we say a, b are not identical on the boundary. In this case sub-digraph G (cid:48) will be extended from a vertex y andtwo elements c , c ∈ L x,a ( y ). This is done by adding G L,yc ,c \ B ( G L,yc ,c ) into G (cid:48) and the boundaryvertices of G (cid:48) are updated by the vertices of B ( G L,yc ,c ) that are not already in G (cid:48) . If the procedure RemoveMinority finds a homomorphism that maps x to a in the sub-digraph G (cid:48) then we remove b from L ( x ), otherwise, we remove a from L ( x ). Following the proof of correctness of the Algorithm1 in [38] and Algorithm 2 we obtain the correctness of this procedure. For every a, b ∈ L ( x ) , one of the ( a, b ) , ( b, a ) is not minority Let a ∈ L ( x ) and let L (cid:48) x,a bethe subset of lists L x,a in which for every y ∈ G , and every c , c ∈ L ( y ), ( c , c ) is a minoritypair. We get to this point because there is no L (cid:48) x,a -homomorphism from G to H that maps x to a .One reason is because at least one of the ( a, b ) , ( b, a ) is not a minority pair for a, b ∈ L ( x ). If forevery c ∈ L ( x ), ( a, c ) is not a minority pair then at the end we should see whether there exists an L x,a -homomorphism from G to H . Algorithm 4
RemoveMinority – Using Maltsev Property function RemoveMinority ( G, H, L ) Preprocessing ( G, H, L ) and if a list becomes empty then return ∅ Consider each connected component of G × L H separately (cid:46) we assume G × L H is connected ∀ x ∈ V ( G ) and ∀ a, b ∈ L ( x ), if a, b are twins then remove b from L ( x ). for all x ∈ V ( G ) , a, b ∈ L ( x ) with a (cid:54) = b do ( G (cid:48) , L (cid:48) ) = G-xab ( G, L, x, a, b ) g xa,b = RemoveMinority ( G (cid:48) , H, L (cid:48) ) if g xa,b is empty then remove a from L ( x ) else remove b from L ( x ) Preprocessing (
G, H, L ) Set ψ to be an empty homomorphism. if ∃ x ∈ V ( G ) with L ( x ) is empty then return ∅ . else for all x ∈ V ( G ) do ψ ( x ) = L ( x ) (cid:46) in this case the lists are singletons return ψ : Input:
Digraphs G , lists L and, x ∈ V ( G ), a, b ∈ L ( x ) function G-xab ( G, L, x, a, b ) Set (cid:91) G L,xa,b = G L,xa,b \ B ( G L,xa,b ), and B (cid:48) = B ( G L,xa,b ) Set stack S to be empty and set L = L x,a push x, a, b into S while S is not empty do pop ( x (cid:48) , a (cid:48) , b (cid:48) ) from S for all y ∈ B (cid:48) and c , c ∈ L ( y ) s.t. y, c , c witness x (cid:48) , a (cid:48) , b (cid:48) at z, d , d do Add new vertices from G L ,yc ,c \ B ( G L ,yc ,c ) into (cid:91) G L,xa,b
Update B (cid:48) by adding new boundary vertices from B ( G L ,yc ,c ) and removing the oldboundary vertices from B (cid:48) that become internal vertices push ( y, c , c ) into S Initialize new lists L (cid:48) and ∀ y ∈ (cid:91) G L,xa,b , set L (cid:48) ( y ) = L ( y ) return ( (cid:91) G L,xa,b , L (cid:48) ) (cid:46) L (cid:48) lists should be (2 , Lemma 5.7
Suppose a, b ∈ L ( x ) and both ( a, b ) , ( b, a ) are minority pairs. Then one of the follow-ing occurs.1. For every y, z ∈ B ( G L,xa,b ) , L x,a ( y, z ) = L x,b ( y, z ) , and ∀ w ∈ B ( G L,xa,b ) , c , c ∈ L x,a ( w ) , ( c , c ) is minority.2. For every y, z ∈ B ( G L,xa,b ) , L x,a ( y, z ) ∩ L x,b ( y, z ) = ∅ , and ∀ w ∈ B ( G L,xa,b ) , c , c ∈ L x,a ( w ) , ( c , c ) is minority.3. There is w ∈ B ( G L,xa,b ) and vertices b , b ∈ L x,a ( w ) such that ( b , b ) is not a minority pair. Proof:
First assume for every y ∈ B ( G L,xa,b ) and every c, d ∈ L x,a ( y ), ( c, d ) is a minority pairand every c, d ∈ L x,b ( y ), ( c, d ) is a minority pair. Let e, l ∈ L ( z ) such that ( a , e ) ∈ L ( v, z ) and( a , l ) ∈ L ( v, z ). Notice that since z ∈ B ( G L,xa,b ), we must have a rectangle forming with x, a, b and z, c, d . Without lose of generality we may assume that the internal vertices of this rectangle in L ( v )are a , a , a , a (see Figure 14). ab cda a a a elx v yz Figure 14:
The pair lists on boundary vertices are the same. a , e ) , ( a , l ) ∈ L ( v, z ). Let a (cid:48) ∈ L ( v ) such that ( a, a (cid:48) ) ∈ L ( x, v ) and ( a (cid:48) , c ) ∈ L ( v, y ) and suppose ( a (cid:48) , t ) ∈ L ( v, z ). Let f ( v ; a (cid:48) , a k − , a ) = a (cid:48)(cid:48) . By applying f on L ( Y [ v, x ])[ a (cid:48) , a ] ,L ( Y [ v, x ])[ a , a ] , L ( Y [ v, x ])[ a , b ] , L ( Z [ v, z ])[ a , e ] , L ( Z [ v, z ])[ a , e ] , L ( Z [ v, z ])[ a (cid:48) , t ] , we conclude that( a (cid:48)(cid:48) , b ) ∈ L ( v, x ), ( a (cid:48)(cid:48) , c ) ∈ L ( v, y ), and ( a (cid:48)(cid:48) , t ) ∈ L ( v, z ). These mean that ( t, c ) ∈ L x,a ( z, y ) if andonly if ( t, c ) ∈ L x,b ( z, y ). By symmetry, if there exists a (cid:48) ∈ L ( v ) such that ( a (cid:48) , d ) ∈ L ( v, y ) and( b, a (cid:48) ) ∈ L ( x, y ) then ( a (cid:48)(cid:48) , t ) ∈ L x,b ( z, y ) if and only if ( a (cid:48)(cid:48) , t ) ∈ L x,a ( z, y ), and hence, ( t, c ) ∈ L x,a ( z, y ) if and only if ( t, c ) ∈ L x,b ( z, y ). Now suppose a (cid:48) ∈ L ( v ) such that ( b, a (cid:48) ) ∈ L ( x, v ),( a (cid:48) , c ) ∈ L ( v, y ). Let ( a (cid:48) , t ) ∈ L ( v, z ) and let f ( v ; a , a k − , a (cid:48) ) = a (cid:48)(cid:48) . Again by applying the poly-morphism f on L ( Y [ v, x ])[ a (cid:48) , a ] , L ( Y [ v, x ])[ a , a ] , L ( Y [ v, x ])[ a (cid:48) , b ] we conclude that ( a (cid:48)(cid:48) , a ) ∈ L ( v, x ).Therefore, ( t, c ) ∈ L x,b ( y, z ) if and only if ( t, c ) ∈ L x,a ( y, z ).Second, suppose ( a , e ) , ( a , l ) ∈ L ( v, z ) (see Figure 15). Let a (cid:48) ∈ L ( v ) such that ( a, a (cid:48) ) ∈ L ( x, v ) and ( a (cid:48) , c ) ∈ L ( v, y ) and suppose ( a (cid:48) , t ) ∈ L ( v, z ). Notice that ( t, c ) ∈ L x,a ( z, y ). Let f ( v ; a (cid:48) , a k − , a ) = a (cid:48) . By applying f on L ( Y [ v, x ])[ a (cid:48) , a ] , L ( Y [ v, x ])[ a , a ] , L ( Y [ v, x ])[ a , b ] ,L ( Y [ v, z ])[ a , e ] , L ( Y [ v, z ])[ a , e ] , L ( Y [ v, z ])[ a (cid:48) , t ] , L ( Y [ v, y ])[ a (cid:48) , c ] , L ( Y [ v, y ])[ a , c ] , L ( Y [ v, x ])[ a , d ],we conclude that ( a (cid:48) , b ) ∈ L ( v, x ), ( a (cid:48) , d ) ∈ L ( v, y ), ( a (cid:48) , t ) ∈ L ( v, z ), and hence, ( t, d ) ∈ L x,b ( y, z ).By symmetry, when ( b, a (cid:48) ) ∈ L ( x, v ), ( a (cid:48) , c ) ∈ L ( v, y ), and ( a (cid:48) , r ) ∈ L ( v, z ), then there exists a (cid:48) ∈ L ( v ) such that ( a, a (cid:48) ) ∈ L ( x, v ), ( a (cid:48) , b ) ∈ L ( v, y ), and ( a (cid:48) , r ) ∈ L ( v, z ). We also observe thatif ( a , e ) ∈ L ( v, z ) then by rectangle property we have ( a , l ) , ( a , e ) , ( a , l ) ∈ L ( v, z ) and now it iseasy to see that L x,a ( y, z ) = L x,b ( y, z ) and (1) holds. Thus we assume that ( a , e ) (cid:54)∈ L ( y, z ) and italso follows that ( a , e ) , ( a , l ) , ( a , l ) (cid:54)∈ L ( v, z ). Since, the choice of a , a , a , a are arbitrary, it iseasy to see that L x,a ( y, z ) ∩ L x,b ( y, z ) = ∅ . ab cda a a a elx v yz Figure 15:
The pair lists on boundary vertices are disjoint
Proof of 3 . Suppose none of the (2,3) occurs. Let y, z ∈ B ( G L,xa,b ), and let Y be an oriented pathfrom x to y in G L,xa,b and Z be an oriented path from x to z . Let v be a vertex in the intersectionof Z, Y . Consider vertices a , a , a , a ∈ L ( v ) such that ( a, a ) , ( a, a ) , ( b, a ) , ( b, a ) ∈ L ( x, v )and ( a , c ) , ( a , c ) , ( a , d ) , ( a , d ) ∈ L ( v, y ). First assume that there exist e, l ∈ L ( z ) such that( a , e ) , ( a , e ) ∈ L ( v, z ), and ( a , l ) , ( a , l ) ∈ L ( v, z ). In this case, we have ( e, c ) , ( l, d ) ∈ L x,a ( y, z ),and ( e, d ) , ( l, c ) ∈ L x,b ( y, z ). We may assume that L x,a ( y, z ) , L x,b ( y, z ) has an intersection. Withoutloss of generality, assume that there exists some a ∈ L x,b ( v ) such that ( a , e ) ∈ L x,b ( v, y ), ( a , c ) ∈ L x,b ( v, y ), and ( e, c ) ∈ L x,b ( z, y ) (see Figure 16).31 b cda a a a elx v yza a a Figure 16: Finding a non minority pair .Let a = f ( v ; a , a k − , a ). Notice that by applying f on Y [ x, y ], and L ( Y [ x, y ]), starting at( x ; a k , b ) to ( v ; a , a k − , a ), we conclude that there is a path in L ( Y [ x, v ]) from a to a . Moreover,by applying f on Y [ v, z ], and L ( Y [ v, z ]), starting at ( x ; a , a k − , a ) to ( z ; e k ), we conclude thatthere is a path in L ( Y [ v, z ]) from a to e so ( a , e ) ∈ L x,a ( v, z ). Finally, by applying the f on Y [ v, y ], L ( Y [ v, y ]), we would get a path in L ( Y [ v, y ]) from a to f ( y ; c k , d ). If ( a , d ) (cid:54)∈ L ( v, y ),then ( c, d ) is not a minority pair, and hence, w = z , and ( b , b ) = ( c, d ). Notice that if there existsat least one a ∈ L ( v ) so that ( a , e ) ∈ L x,a ( v, z ), ( a, a ) ∈ L x,a ( x, v ), ( a , d ) ∈ L x,a ( v, y ) then wecan’t conclude that ( c, d ) is not a minority pair. So we may assume such a exists, and we continue.Let a = f ( v ; a , a k − , a ). Notice that since f is a polymorphism, ( a, a ) ∈ L x,a ( x, v ). Now if( a , c ) (cid:54)∈ L x,a ( v, y ) then f ( x ; d k , c ) (cid:54) = c , and hence, ( d, c ) is not a minority pair, and we set w = y ,and ( b , b ) = ( d, c ). Thus, we continue by assuming ( a , c ) ∈ L x,a ( v, y ). Now by following, f on Z [ v, z ], L ( Z [ v, z ]) we conclude that ( a , f ( v ; e k , l )) ∈ L x,a ( v, z ). Therefore, if ( a , l ) (cid:54)∈ L x,a ( z, v )then ( e, l ) is not a minority pair and we can set w = z , and ( b , b ) = ( e, l ). Thus, we continue byassuming that ( a , l ) ∈ L x,a ( v, z ), and hence, ( l, c ) ∈ L x,a ( z, y ) ∩ L x,b ( z, y ).Next, let f ( v ; a , a k , a ) = a . Now by applying f , we conclude that ( b, a ) ∈ L ( x, v ). Byfollowing, f on Z [ v, z ], L ( Z [ v, z ]) we conclude that ( a , l ) ∈ L x,b ( v, z ), otherwise, ( e, l ) is notminority pair and we are done. By following, f on Z [ v, y ], L ( Y [ v, y ]), we conclude that ( a , d ) ∈ L x,b ( v, y ), otherwise, ( c, d ) is not a minority pair. Therefore, ( l, d ) ∈ L x,a ( z, y ) ∩ L x,b ( z, y ). Since a was an arbitrary vertex, we conclude that L x,a ( y, z ) = L x,b ( y, z ), a contradiction to our assumption.The argument when ( a , e ) , ( a , e ) ∈ L ( v, z ) and ( a , l ) , ( a , l ) ∈ L ( v, z ) is similar. Note that whenone of the (1,2) occurs on B ( G L,xa,b ) and (3) does happened and (3) does not happened then it isnot difficult that we can assume that for every y ∈ B ( G L,xa,b ) and every c , c ∈ L x,a ( y ), ( c , c ) is aminority pair. (cid:5) Lemma 5.8
The Algorithm 3 correctly finds a homomorphism from G to H if one exists, and runsin polynomial time of | G || H | and a polynomial of |H| . Proof:
The correctness of the algorithm follows from the correctness of the Algorithm 2 and thealgorithm in [38]. Moreover, as we argue in the text before the algorithm, Lemma 5.6, and Lemma5.7 justify the way we handle the minority pairs. The Algorithm in [38] and Algorithm 2 are32olynomial of ( poly ( | G | ) ∗ poly ( | H | )). By the construction of G, H, L , the size of each list L is apolynomial of H . Therefore, it is not difficult to see that the Algorithm 3 runs in polynomial of |H| . (cid:5) We have implemented our algorithm and have tested it on some inputs. The instances are mainlyconstructed according to the construction in subsection 3.1. Q Q Q Q Q Figure 17: Oriented paths of height 733
Relation H Q Q Q Q Q Q Q Q Q Q Q Q Relation H Q Q Q Q Q Q Q Q Q Q Q Q Relation H
12 13 14 151 2 345 Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Graph G
Vertices 178Edges 180
Graph H
Vertices 198Edges 205
Running Time Graph G
Vertices 178Edges 180
Graph H
Vertices 198Edges 205
Running Time Graph G
Vertices 387Edges 392
Graph H
Vertices 198Edges 205
Running Time Figure 18: H is constructed from a relation of 5-tuples and of arity 5. G is constructed from abipartite graph where each edge in G is replaced by one of the oriented paths depicted in Figure17. 34 Relation H Q Q Q Q Q Q Q Q Q Q Q Q Relation H
12 13 14 151 2 345 Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Relation G
Relation H Graph G
Vertices 178Edges 180
Graph H
Vertices 789Edges 828
Running Time Graph G
Vertices 387Edges 392
Graph H
Vertices 789Edges 828
Running Time Graph G
Vertices 679Edges 708
Graph H
Vertices 876Edges 920
Running Time Figure 19: First two H digraphs constructed by a relation of 9-tuples and of arity 5 (which isclosed under a semmi-lattice block Maltsev polymorphism, 01 , , G digraphsconstructed from bipartite graphs by replacing their edges with oriented paths. The last instance, G and H are constructed from two relations according to the construction in Subsection 3.135 Relation G
Relation H
Relation H Q Q Q Q Q Q Q Q Q Q Q Q Relation H
12 13 14 151 2 345 Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Graph G
Vertices 846Edges 885
Graph H
Vertices 876Edges 920
Running Time Graph G
Vertices 178Edges 180
Graph H
Vertices 549Edges 574
Running Time Graph G
Vertices 387Edges 392
Graph H
Vertices 549Edges 574
Running Time Figure 20: In the first instance, G and H are constructed from two relations according to theconstruction in Subsection 3.1. In the last two instances, H is based on relation of 14-tuples andarity 5. G is constructed from a bipartite graph using the oriented paths depicted in Figure 17.36 Graph G Graph H
Vertices 50 Vertices 10800Edges 1850 Edges 38071800Number of tuples 50 Number of tuples 216Arity of relation 4 Arity of relation 4Alphabet of relation 15 Alphabet of relation 6
Running Time Graph G Graph H
Vertices 100 Vertices 12500Edges 6192 Edges 73311500Number of tuples 100 Number of tuples 125Arity of relation 4 Arity of relation 4Alphabet of relation 20 Alphabet of relation 5
Running Time Graph G Graph H
Vertices 400 Vertices 20000Edges 99826 Edges 193050572Number of tuples 400 Number of tuples 50Arity of relation 4 Arity of relation 4Alphabet of relation 20 Alphabet of relation 5
Running Time Graph G Graph H
Vertices 750 Vertices 37500Edges 350672 Edges 680731180Number of tuples 750 Number of tuples 50Arity of relation 4 Arity of relation 4Alphabet of relation 20 Alphabet of relation 5
Running Time Figure 21: The examples constructed from random relations G and random target relations H .The H relations are closed under a weak NU polymorphims of arity 3 which are not semilattice-block-Maltsev. 37 cknowledgements: We would like to thank V´ıctor Dalmau, Ross Willard, Pavol Hell, andAkbar 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 satisfi-ability 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 semicompletedigraphs.
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 directedgraphs.
Discrete Appl. Math. , 26 : 1–23, 1990.[4] L. Barto, M. Kozik, and T. Niven. The CSP dichotomy holds for digraphs with no sources andno 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 andvarieties 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 IEEEAnnual Symposium on Foundations of Computer Science, FOCS
SIAM J. Comput. ,36(1): 16–27, 2006.[11] A. Bulatov, P. Jeavons, and A. Krokhin. Classifying the complexity of constraint using finitealgebras.
SIAM journal on computing , 34(3): 720-742, 2005.[12] J.Y. Cai, X. Chen, and P. Lu. Graph homomorphisms with complex values: A dichotomytheorem.
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 onComputation Theory (TOCT) , 9 (3), 2017.[15] N. Creignou, S. Khanna, and M. Sudan. Complexity classifications of boolean constraint satis-faction problems.
SIAM Monographs on Discrete Math. and Applications , vol. 7, 2001.[16] P. Csikv´ari and Z. Lin. Graph homomorphisms between trees.
Elec. J. Combin. , 21 : 4–9 ,2014.[17] R. Dechter. Constraint networks.
Encyclopedia of Artificial Intelligence
Proceedings 6th Inter-national Symposium on Artificial Intelligence and Mathematics , 2000.
19] V. Dalmau, D. Ford. Generalized satisfiability with k occurrences per variable: A study throughdelta-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 k -partite satisfiability. SIAM J. DiscreteMath. , 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 problemsinvolving unary functions.
Theoret. Comput. Sci. , 314 : 1–43, 2004.[29] T.Feder and M.Vardi. Monotone monadic SNP and constraint satisfaction. In
Proceedings ofSTOC , 612–622, 1993.[30] T. Feder and M.Y. Vardi. The computational structure of monotone monadic SNP constraintsatisfaction: A study through Datalog and group theory.
SIAM Journal on Computing , 28(1):57–104, 1998.[31] P. Hell and J. Neˇsetˇril. On the complexity of H -colouring. J. Combin. Theory B , 48 : 92–110,1990.[32] P. Hell and J. Neˇsetˇril.
Graphs and Homomorphisms , Oxford University Press, 2004.[33] P.Hell and J.Neˇsetˇril. Colouring, constraint satisfaction, and complexity.
Computer ScienceReview , 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 ofSODA
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 treesand 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´adori. 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.
AlgebraUniversalis , 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 19thSymposium 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 onFoundations of Computer Science, FOCS331–342, 2017.