The Complexity of Transitively Orienting Temporal Graphs
George B. Mertzios, Hendrik Molter, Malte Renken, Paul G. Spirakis, Philipp Zschoche
TThe Complexity of Transitively OrientingTemporal Graphs
George B. Mertzios ! Department of Computer Science, Durham University, UK
Hendrik Molter ! Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany
Malte Renken ! Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany
Paul G. Spirakis ! Department of Computer Science, University of Liverpool, UKComputer Engineering & Informatics Department, University of Patras, Greece
Philipp Zschoche ! Technische Universität Berlin, Faculty IV, Algorithmics and Computational Complexity, Germany
Abstract
In a temporal network with discrete time-labels on its edges, entities and information can only “flow”along sequences of edges whose time-labels are non-decreasing (resp. increasing), i.e. along temporal(resp. strict temporal) paths. Nevertheless, in the model for temporal networks of [Kempe, Kleinberg,Kumar, JCSS, 2002], the individual time-labeled edges remain undirected: an edge e = { u, v } withtime-label t specifies that “ u communicates with v at time t ”. This is a symmetric relation between u and v , and it can be interpreted that the information can flow in either direction. In this paperwe make a first attempt to understand how the direction of information flow on one edge can impactthe direction of information flow on other edges. More specifically, naturally extending the classicalnotion of a transitive orientation in static graphs, we introduce the notion of a temporal transitiveorientation and we systematically investigate its algorithmic behavior in various situations. Anorientation of a temporal graph is called temporally transitive if, whenever u has a directed edgetowards v with time-label t and v has a directed edge towards w with time-label t ≥ t , then u alsohas a directed edge towards w with some time-label t ≥ t . If we just demand that this implicationholds whenever t > t , the orientation is called strictly temporally transitive, as it is based on thefact that there is a strict directed temporal path from u to w . Our main result is a conceptuallysimple, yet technically quite involved, polynomial-time algorithm for recognizing whether a giventemporal graph G is transitively orientable. In wide contrast we prove that, surprisingly, it isNP-hard to recognize whether G is strictly transitively orientable. Additionally we introduce andinvestigate further related problems to temporal transitivity, notably among them the temporaltransitive completion problem, for which we prove both algorithmic and hardness results. Theory of computation → Graph algorithms analysis; Mathem-atics of computing → Discrete mathematics
Keywords and phrases
Temporal graph, transitive orientation, transitive closure, polynomial-timealgorithm, NP-hardness, satisfiability.
Funding
George B. Mertzios : Supported by the EPSRC grant EP/P020372/1.
Hendrik Molter : Supported by the German Research Foundation (DFG), project MATE (NI 369/17).
Malte Renken : Supported by the German Research Foundation (DFG), project MATE (NI 369/17).
Paul G. Spirakis : Supported by the NeST initiative of the School of EEE and CS at the Universityof Liverpool and by the EPSRC grant EP/P02002X/1. a r X i v : . [ c s . D S ] F e b The Complexity of Transitively Orienting Temporal Graphs A temporal (or dynamic ) network is, roughly speaking, a network whose underlying topologychanges over time. This notion concerns a great variety of both modern and traditionalnetworks; information and communication networks, social networks, and several physicalsystems are only few examples of networks which change over time [27,38,41]. Due to its vastapplicability in many areas, the notion of temporal graphs has been studied from differentperspectives under several different names such as time-varying , evolving , dynamic , and graphs over time (see [13–15] and the references therein). In this paper we adopt a simpleand natural model for temporal networks which is given with discrete time-labels on theedges of a graph, while the vertex set remains unchanged. This formalism originates in thefoundational work of Kempe et al. [28]. ▶ Definition 1 (Temporal Graph [28]) . A temporal graph is a pair G = ( G, λ ) , where G = ( V, E ) is an underlying (static) graph and λ : E → N is a time-labeling function whichassigns to every edge of G a discrete-time label. Mainly motivated by the fact that, due to causality, entities and information in temporalgraphs can only “flow” along sequences of edges whose time-labels are non-decreasing(resp. increasing), Kempe et al. introduced the notion of a (strict) temporal path , or (strict)time-respecting path , in a temporal graph (
G, λ ) as a path in G with edges e , e , . . . , e k such that λ ( e ) ≤ . . . ≤ λ ( e k ) (resp. λ ( e ) < . . . < λ ( e k )). This notion of a temporal pathnaturally resembles the notion of a directed path in the classical static graphs, where thedirection is from smaller to larger time-labels along the path. Nevertheless, in temporal pathsthe individual time-labeled edges remain undirected: an edge e = { u, v } with time-label λ ( e ) = t can be abstractly interpreted as “ u communicates with v at time t ”. Here therelation “communicates” is symmetric between u and v , i.e. it can be interpreted that theinformation can flow in either direction.In this paper we make a first attempt to understand how the direction of information flowon one edge can impact the direction of information flow on other edges. More specifically,naturally extending the classical notion of a transitive orientation in static graphs [24], weintroduce the notion of a temporal transitive orientation and we thoroughly investigate itsalgorithmic behavior in various situations. Imagine that v receives information from u attime t , while w receives information from v at time t ≥ t . Then w indirectly receivesinformation from u through the intermediate vertex v . Now, if the temporal graph correctlyrecords the transitive closure of information passing, the directed edge from u to w mustexist and must have a time label t ≥ t . In such a transitively oriented temporal graph,whenever an edge is oriented from a vertex u to a vertex w with time-label t , we have that every temporal path from u to w arrives no later than t , and that there is no temporal pathfrom w to u . Different notions of temporal transitivity have also been used for automatedtemporal data mining [40] in medical applications [39], text processing [45]. Furthermore, inbehavioral ecology, researchers have used a notion of orderly (transitive) triads A-B-C toquantify dominance among species. In particular, animal groups usually form dominancehierarchies in which dominance relations are transitive and can also change with time [33].One natural motivation for our temporal transitivity notion comes from thinking aboutvertices u, v, w as journalists or lawyers. Suppose that v queried some important informationfrom u (the information source) at time t , and afterwards, at time t ≥ t , w queried theimportant information from v (the intermediary). Then, in order to ensure the validity ofthe information received, w might want to verify it by subsequently querying the informationdirectly from u at some time t ≥ t . Note that w might first receive the important information .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 3 from u through various intermediaries, and using several channels of different lengths. Then,to maximize confidence about the information, w should query u for verification only afterreceiving the information from the latest of these indirect channels.It is worth noting here that the model of temporal graphs given in Definition 1 has beenalso used in its extended form, in which the temporal graph may contain multiple time-labelsper edge [35]. This extended temporal graph model has been used to investigate temporalpaths [3, 9, 11, 16, 35, 48] and other temporal path-related notions such as temporal analoguesof distance and diameter [1], reachability [2] and exploration [1,3,20,21], separation [22,28,49],and path-based centrality measures [12,29], as well as recently non-path problems too such astemporal variations of coloring [37], vertex cover [4], matching [36], cluster editing [18], andmaximal cliques [8, 26, 47]. However, in order to better investigate and illustrate the inherentcombinatorial structure of temporal transitivity orientations, in this paper we mostly followthe original definition of temporal graphs given by Kempe et al. [28] with one time-label peredge [7, 17, 19]. Throughout the paper, whenever we assume multiple time-labels per edge wewill state it explicitly; in all other cases we consider a single label per edge.In static graphs, the transitive orientation problem has received extensive attention whichresulted in numerous efficient algorithms. A graph is called transitively orientable (or a comparability graph) if it is possible to orient its edges such that, whenever we orient u towards v and v towards w , then the edge between u and w exists and is oriented towards w .The first polynomial-time algorithms for recognizing whether a given (static) graph G on n vertices and m edges is comparability (i.e. transitively orientable) were based on the notionof forcing an orientation and had running time O ( n ) (see Golumbic [24] and the referencestherein). Faster algorithms for computing a transitive orientation of a given comparabilitygraph have been later developed, having running times O ( n ) [43] and O ( n + m log n ) [30],while the currently fastest algorithms run in linear O ( n + m ) time and are based on efficientlycomputing a modular decomposition of G [31, 32]; see also Spinrad [44]. It is fascinatingthat, although all the latter algorithms compute a valid transitive orientation if G is acomparability graph, they fail to recognize whether the input graph is a comparability graph;instead they produce an orientation which is non-transitive if G is not a comparability graph.The fastest known algorithm for determining whether a given orientation is transitive requiresmatrix multiplication, currently achieved in O ( n . ) time [5]. Our contribution.
In this paper we introduce the notion of temporal transitive orientation and we thoroughly investigate its algorithmic behavior in various situations. An orientation ofa temporal graph G = ( G, λ ) is called temporally transitive if, whenever u has a directed edgetowards v with time-label t and v has a directed edge towards w with time-label t ≥ t , then u also has a directed edge towards w with some time-label t ≥ t . If we just demandthat this implication holds whenever t > t , the orientation is called strictly temporallytransitive, as it is based on the fact that there is a strict directed temporal path from u to w .Similarly, if we demand that the transitive directed edge from u to w has time-label t > t ,the orientation is called strongly (resp. strongly strictly) temporally transitive.Although these four natural variations of a temporally transitive orientation seem super-ficially similar to each other, it turns out that their computational complexity (and theirunderlying combinatorial structure) varies massively. Indeed we obtain a surprising resultin Section 3: deciding whether a temporal graph G admits a temporally transitive orientationis solvable in polynomial time (Section 3.1), while it is NP-hard to decide whether it admits That is, whenever there exists a (non-strict) directed temporal path from u to w arriving at time t The Complexity of Transitively Orienting Temporal Graphs a strictly temporally transitive orientation (Section 3.2). On the other hand, it turns out that,deciding whether G admits a strongly or a strongly strictly temporal transitive orientation is(easily) solvable in polynomial time as they can both be reduced to 2SAT satisfiability.Our main result is that, given a temporal graph G = ( G, λ ), we can decide in polynomialtime whether G can be transitively orientable, and at the same time we can output a temporaltransitive orientation if it exists. Our algorithm, whose proof of correctness is technically quiteinvolved, is conceptually simple and easy to implement. It is heavily based on the notion of forcing an orientation , thus extending the classical polynomial-time algorithm for computinga transitive orientation in static graphs described by Golumbic [24]. However, in contrastto the case of static graphs, it turns out that, in temporal graphs, we cannot use simpleorientation forcings to eliminate the condition that a triangle cannot be oriented cyclically.To resolve this issue, we prove that the recognition problem of temporally transitive graphsis equivalent to deciding the Boolean satisfiability of a mixed formula ϕ NAE ∧ ϕ SAT . Here ϕ is a formula, i.e., the disjunction of clauses with three literals each, where everyclause NAE ( ℓ , ℓ , ℓ ) is satisfied if and only if at least one of the literals { ℓ , ℓ , ℓ } is equalto 1 and at least one of them is equal to 0. Note that every clause NAE ( ℓ , ℓ , ℓ ) correspondsto the condition that a specific triangle in the temporal graph cannot be cyclically oriented.Furthermore ϕ is a 2SAT formula, i.e., the disjunction of 2CNF clauses with two literalseach, where every clause ( ℓ ∨ ℓ ) is satisfied if and only if at least one of the literals { ℓ , ℓ } is equal to 1.However, although deciding whether ϕ is satisfiable can be done in linear time withrespect to the size of the formula [6], the problem Not-All-Equal-3-SAT is NP-complete [42].Therefore, expressing our problem as a Boolean satisfiability problem in this sense does nothelp deducing a polynomial-time algorithm (unless P=NP). Nevertheless, we prove a sequenceof structural properties that a temporally transitive orientation has to satisfy, which allowsus to present a polynomial-time algorithm for this problem. This phenomenon of deducing apolynomial-time algorithm for an algorithmic graph problem by deciding satisfiability of amixed Boolean formula (i.e. with both clauses of two and three literals) occurs rarely; thisapproach has been successfully used for the efficient recognition of simple-triangle (knownalso as “PI”) graphs [34].In the second part of our paper (Section 4) we consider a natural extension of the temporalorientability problem, namely the temporal transitive completion problem. In this problemwe are given a temporal graph G and a natural number k , and the question is whether it ispossible to add at most k new edges (with the corresponding time-labels) to G such that theresulting temporal graph is (strongly/strictly/strongly strictly) transitively orientable. Weprove that all four versions of temporal transitive completion are NP-complete. In contrastwe show that, if the input temporal graph G is directed (i.e. if every time-labeled edgehas a fixed orientation) then all versions of temporal transitive completion are solvable inpolynomial time. As a corollary of our results it follows that all four versions of temporaltransitive completion are fixed-parameter-tractable (FPT) with respect to the number q ofunoriented time-labeled edges in G .In the third and last part of our paper (Section 5) we consider the multilayer transitiveorientation problem. In this problem we are given an undirected temporal graph G = ( G, λ ),where G = ( V, E ), and we ask whether there exists an orientation F of its edges (i.e. withexactly one orientation for each edge of G ) such that, for every ‘time-layer” t ≥
1, the (static)oriented graph induced by the edges having time-label t is transitively oriented in F . Problem That is, orienting an edge from u to v forces us to orient another edge from a to b . .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 5 definitions of this type are commonly referred to as multilayer problems [10], Observe thatthis problem trivially reduces to the static case if we assume that each edge has a singletime-label, as then each layer can be treated independently of all others. However, if weallow G to have multiple time-labels on every edge of G , then we show that the problembecomes NP-complete, even when every edge has at most two labels. Given a (static) undirected graph G = ( V, E ), an edge between two vertices u, v ∈ V isdenoted by the unordered pair { u, v } ∈ E , and in this case the vertices u, v are said tobe adjacent . If the graph is directed, we will use the ordered pair ( u, v ) (resp. ( v, u )) todenote the oriented edge from u to v (resp. from v to u ). For simplicity of the notation, wewill usually drop the parentheses and the comma when denoting an oriented edge, i.e. wewill denote ( u, v ) just by uv . Furthermore, c uv = { uv, vu } is used to denote the set of bothoriented edges uv and vu between the vertices u and v .Let S ⊆ E be a subset of the edges of an undirected (static) graph G = ( V, E ), and let b S = { uv, vu : { u, v } ∈ S } be the set of both possible orientations uv and vu of every edge { u, v } ∈ S . Let F ⊆ b S . If F contains at least one of the two possible orientations uv and vu of an edge { u, v } ∈ S , then F is called an orientation of the edges of S . F is calleda proper orientation if it contains exactly one of the orientations uv and vu of every edge { u, v } ∈ S . Note here that, in order to simplify some technical proofs, the above definitionof an orientation allows F to be not proper, i.e. to contain both uv and vu for a specific edge { u, v } . However, whenever F is not proper, this means that F can be discarded as it cannotbe used as a part of a (temporal) transitive orientation. For every orientation F denote by F − = { vu : uv ∈ F } the reversal of F . Note that F ∩ F − = ∅ if and only if F is proper.In a temporal graph G = ( G, λ ), where G = ( V, E ), whenever λ ( { v, w } ) = t (or simply λ ( v, w ) = t ), we refer to the tuple ( { v, w } , t ) as a time-edge of G . A triangle of ( G, λ ) onthe vertices u, v, w is a synchronous triangle if λ ( u, v ) = λ ( v, w ) = λ ( w, u ). Let G = ( V, E )and let F be a proper orientation of the whole edge set E . Then ( G , F ), or ( G, λ, F ), is a proper orientation of the temporal graph G . An partial proper orientation of a temporalgraph G = ( G, λ, F ) is an orientation of a subset of E . To indicate that the edge { u, v } of atime-edge ( { u, v } , t ) is oriented from u to v (that is, uv ∈ F in a (partial) proper orientation F ), we use the term (( u, v ) , t ), or simply ( uv, t ). For simplicity we may refer to a (partial)proper orientation just as a (partial) orientation, whenever the term “proper” is clear fromthe context.A static graph G = ( V, E ) is a comparability graph if there exists a proper orientation F of E which is transitive , that is, if F ∩ F − = ∅ and F ⊆ F , where F = { uw : uv, vw ∈ F for some vertex v } [24]. Analogously, in a temporal graph G = ( G, λ ), where G = ( V, E ), wedefine a proper orientation F of E to be temporally transitive , if:whenever ( uv, t ) and ( vw, t ) are oriented time-edges in ( G , F ) such that t ≥ t , thereexists an oriented time-edge ( wu, t ) in ( G , F ), for some t ≥ t .In the above definition of a temporally transitive orientation, if we replace the condition“ t ≥ t ” with “ t > t ”, then F is called strongly temporally transitive . If we instead replacethe condition “ t ≥ t ” with “ t > t ”, then F is called strictly temporally transitive . If wedo both of these replacements, then F is called strongly strictly temporally transitive . Notethat strong (strict) temporal transitivity implies (strict) temporal transitivity, while (strong)temporal transitivity implies (strong) strict temporal transitivity. Furthermore, similarly to The Complexity of Transitively Orienting Temporal Graphs the established terminology for static graphs, we define a temporal graph G = ( G, λ ), where G = ( V, E ), to be a (strongly/strictly) temporal comparability graph if there exists a properorientation F of E which is (strongly/strictly) temporally transitive .We are now ready to formally introduce the following decision problem of recognizingwhether a given temporal graph is temporally transitively orientable or not. Temporal Transitive Orientation (TTO)
Input:
A temporal graph G = ( G, λ ), where G = ( V, E ). Question:
Does G admit a temporally transitive orientation F of E ? In the above problem definition of
TTO , if we ask for the existence of a strictly(resp. strongly, or strongly strictly) temporally transitive orientation F , we obtain thedecision problem Strict (resp.
Strong , or
Strong Strict ) Temporal TransitiveOrientation (TTO) .Let G = ( G, λ ) be a temporal graph, where G = ( V, E ). Let G ′ = ( V, E ′ ) be a graph suchthat E ⊆ E ′ , and let λ ′ : E ′ → N be a time-labeling function such that λ ′ ( u, v ) = λ ( u, v ) forevery { u, v } ∈ E . Then the temporal graph G ′ = ( G ′ , λ ′ ) is called a temporal supergraph of G .We can now define our next problem definition regarding computing temporally orientablesupergraphs of G . Temporal Transitive Completion (TTC)
Input:
A temporal graph G = ( G, λ ), where G = ( V, E ), a (partial) orientation F of G ,and an integer k . Question:
Does there exist a temporal supergraph G ′ = ( G ′ , λ ′ ) of ( G, λ ), where G ′ = ( V, E ′ ),and a transitive orientation F ′ ⊇ F of G ′ such that | E ′ \ E | ≤ k ? Similarly to
TTO , if we ask in the problem definition of
TTC for the existence of astrictly (resp. strongly, or strongly strictly) temporally transitive orientation F ′ , we obtainthe decision problem Strict (resp.
Strong , or
Strong Strict ) Temporal TransitiveCompletion (TTC) .Now we define our final problem which asks for an orientation F of a temporal graph G = ( G, λ ) (i.e. with exactly one orientation for each edge of G ) such that, for every“time-layer” t ≥
1, the (static) oriented graph defined by the edges having time-label t istransitively oriented in F . This problem does not make much sense if every edge has exactlyone time-label in G , as in this case it can be easily solved by just repeatedly applying anyknown static transitive orientation algorithm. Therefore, in the next problem definition, weassume that in the input temporal graph G = ( G, λ ) every edge of G potentially has multipletime-labels, i.e. the time-labeling function is λ : E → N . Multilayer Transitive Orientation (MTO)
Input:
A temporal graph G = ( G, λ ), where G = ( V, E ) and λ : E → N . Question:
Is there an orientation F of the edges of G such that, for every t ≥
1, the (static)oriented graph induced by the edges having time-label t is transitively oriented? In this section we investigate the computational complexity of all variants of
TTO . Weshow that
TTO as well as the two variants
Strong TTO and
Strong Strict TTO , aresolvable in polynomial time, whereas
Strict TTO turns out to be NP-complete. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 7 u wvt t t u wvt t t = t = t t < t = t t ≤ t < t t = t t < t TTO non-cyclic wu = wv vw = ⇒ uwvu = ⇒ wu uv = wv uv = ⇒ wv Strong TTO ⊥ wu ∧ wv vw = ⇒ uwvu = ⇒ wu uv = wv uv = ⇒ wv Strict TTO ⊤ non-cyclic vw = ⇒ uwvu = ⇒ wu ⊤ uv = ⇒ wv Str. Str. TTO ⊤ wu ∧ wv vw = ⇒ uwvu = ⇒ wu ⊤ uv = ⇒ wv Table 1
Orientation conditions imposed by a triangle (left) and an induced path of length two(right) in the underlying graph G for the decision problems ( Strict / Strong / Strong Strict ) TTO . Here, ⊤ means that no restriction is imposed, ⊥ means that the graph is not orientable, andin the case of triangles, “non-cyclic” means that all orientations except the ones that orient thetriangle cyclicly are allowed. The main idea of our approach to solve
TTO and its variants is to create Booleanvariables for each edge of the underlying graph G and interpret setting a variable to 1 or 0with the two possible ways of directing the corresponding edge.More formally, for every edge { u, v } we introduce a variable x uv and setting this variableto 1 corresponds to the orientation uv while setting this variable to 0 corresponds to theorientation vu . Now consider the example of Figure 1(a), i.e. an induced path of lengthtwo in the underlying graph G on three vertices u, v, w , and let λ ( u, v ) = 1 and λ ( v, w ) = 2.Then the orientation uv “forces” the orientation wv . Indeed, if we otherwise orient { v, w } as vw , then the edge { u, w } must exist and be oriented as uw in any temporal transitiveorientation, which is a contradiction as there is no edge between u and w . We can expressthis “forcing” with the implication x uv = ⇒ x wv . In this way we can deduce the constraintsthat all triangles or induced paths on three vertices impose on any (strong/strict/strongstrict) temporal transitive orientation. We collect all these constraints in Table 1.When looking at the conditions imposed on temporal transitive orientations collectedin Table 1, we can observe that all conditions except “non-cyclic” are expressible in 2SAT.Since 2SAT is solvable in linear time [6], it immediately follows that the strong variants oftemporal transitivity are solvable in polynomial time. ▶ Theorem 2.
Strong TTO and
Strong Strict TTO are solvable in polynomial time.
In the variants
TTO and
Strict TTO , however, we can have triangles that impose a“non-cyclic” orientation of three edges. This can be naturally modeled by a not-all-equal(NAE) clause . However, if we now naïvely model the conditions with a Boolean formula, we A not all equal clause is a set of literals and it evaluates to true if and only if at least two literals in the
The Complexity of Transitively Orienting Temporal Graphs u wv (a) u wv (b)3 55
Figure 1
The orientation uv forces the orientation wu and vice-versa in the examples of (a) astatic graph G where { u, v } , { v, w } ∈ E ( G ) and { u, w } / ∈ E ( G ), and of (b) a temporal graph ( G, λ )where λ ( u, w ) = 3 < λ ( u, v ) = λ ( v, w ). obtain a formula with 2SAT clauses and 3NAE clauses. Deciding whether such a formula issatisfiable is NP-complete in general [42]. Hence, we have to investigate these two variantsmore thoroughly.Indeed we obtain a surprising result: TTO is solvable in polynomial time while
StrictTTO is NP-complete. In the following subsection we provide a polynomial-time algorithmfor
TTO and at the end of the section we prove that
Strict TTO is NP-complete.
Let G = ( V, E ) be a static undirected graph. There are various polynomial-time algorithmsfor deciding whether G admits a transitive orientation F . However our results in this sectionare inspired by the transitive orientation algorithm described by Golumbic [24], which isbased on the crucial notion of forcing an orientation. The notion of forcing in static graphsis illustrated in Figure 1 (a): if we orient the edge { u, v } as uv (i.e., from u to v ) then weare forced to orient the edge { v, w } as wv (i.e., from w to v ) in any transitive orientation F of G . Indeed, if we otherwise orient { v, w } as vw (i.e. from v to w ), then the edge { u, w } must exist and it must be oriented as uw in any transitive orientation F of G , which is acontradiction as { u, w } is not an edge of G . Similarly, if we orient the edge { u, v } as vu thenwe are forced to orient the edge { v, w } as vw . That is, in any transitive orientation F of G we have that uv ∈ F ⇔ wv ∈ F . This forcing operation can be captured by the binaryforcing relation Γ which is defined on the edges of a static graph G as follows [24]. uv Γ u ′ v ′ if and only if (cid:26) either u = u ′ and { v, v ′ } / ∈ E or v = v ′ and { u, u ′ } / ∈ E . (1)We now extend the definition of Γ in a natural way to the binary relation Λ on the edgesof a temporal graph (
G, λ ), see Equation (2). For this, observe from Table 1 that the onlycases, where we have uv ∈ F ⇔ wv ∈ F in any temporal transitive orientation of ( G, λ ), arewhen (i) the vertices u, v, w induce a path of length 2 (see Figure 1 (a)) and λ ( u, v ) = λ ( v, w ),as well as when (ii) u, v, w induce a triangle and λ ( u, w ) < λ ( u, v ) = λ ( v, w ). The lattersituation is illustrated in the example of Figure 1 (b). The binary forcing relation Λ is onlydefined on pairs of edges { u, v } and { u ′ , v ′ } where λ ( u, v ) = λ ( u ′ , v ′ ), as follows. uv Λ u ′ v ′ if and only if λ ( u, v ) = λ ( u ′ , v ′ ) = t and u = u ′ and { v, v ′ } / ∈ E, or v = v ′ and { u, u ′ } / ∈ E, or u = u ′ and λ ( v, v ′ ) < t, or v = v ′ and λ ( u, u ′ ) < t. (2) set evaluate to different truth values. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 9 Note that, for every edge { u, v } ∈ E we have that uv Λ uv . The forcing relation Λ fortemporal graphs shares some properties with the forcing relation Γ for static graphs. Inparticular, the reflexive transitive closure Λ ∗ of Λ is an equivalence relation, which partitionsthe edges of each set E t = {{ u, v } ∈ E : λ ( u, v ) = t } into its Λ -implication classes (or simply,into its implication classes ). Two edges { a, b } and { c, d } are in the same Λ-implication classif and only ab Λ ∗ cd , i.e. there exists a sequence ab = a b Λ a b Λ . . . Λ a k b k = cd , with k ≥ λ ( a , b ) = λ ( a , b ) = . . . = λ ( a k , b k ) = t forsome t ≥
1. Such a sequence is called a Λ-chain from ab to cd , and we say that ab (eventually)Λ-forces cd . Furthermore note that ab Λ ∗ cd if and only if ba Λ ∗ dc . The next observationhelps the reader understand the relationship between the two forcing relations Γ and Λ. ▶ Observation 3.
Let { u, v } ∈ E , where λ ( u, v ) = t , and let A be the Λ -implication classof uv in the temporal graph ( G, λ ) . Let G ′ be the static graph obtained by removing from G all edges { p, q } , where λ ( p, q ) < t . Then A is also the Γ -implication class of uv in the staticgraph G ′ . For the next lemma, we use the notation b A = { uv, vu : uv ∈ A } . ▶ Lemma 4.
Let A be a Λ -implication class of a temporal graph ( G, λ ) . Then either A = A − = b A or A ∩ A − = ∅ . Proof.
Suppose that A ∩ A − ̸ = ∅ , and let uv ∈ A ∩ A − , i.e. uv, vu ∈ A . Then, for any pq ∈ A we have that pq Λ ∗ uv and qp Λ ∗ vu . Since Λ ∗ is an equivalence relation and uv, vu ∈ A , italso follows that pq, qp ∈ A . Therefore also pq, qp ∈ A − , and thus A = A − = b A . ◀▶ Lemma 5.
Let F be a temporal transitive orientation of a temporal graph ( G, λ ) , and let A be a Λ -implication class of ( G, λ ) . Then either A ⊆ F or A − ⊆ F , and in either case A ∩ A − = ∅ . Proof.
We defined the binary forcing relation Λ to capture the fact that, for any temporaltransitive orientation F of ( G, λ ), if ab Λ cd and ab ∈ F , then also cd ∈ F . Applying thisproperty repeatedly, it follows that either A ⊆ F or F ∩ A = ∅ . If A ⊆ F then A − ⊆ F − .On the other hand, if F ∩ A = ∅ then A ⊆ F − , and thus also A − ⊆ F . In either case, thefact that F ∩ F − = ∅ by the definition of a temporal transitive orientation implies that also A ∩ A − = ∅ . ◀ Let now ab = a b Λ a b Λ . . . Λ a k b k = cd be a given Λ-chain. Note by Equation (2)that, for every i = 1 , . . . , k , we have that either a i − = a i or b i − = b i . Therefore we canreplace the Λ-implication a i − b i − Λ a i b i by the implications a i − b i − Λ a i b i − Λ a i b i , sinceeither a i b i − = a i − b i − or a i b i − = a i b i . Thus, as this addition of this middle edge is alwayspossible in a Λ-implication, we can now define the notion of a canonical Λ-chain, whichalways exists. ▶ Definition 6.
Let ab Λ ∗ cd . Then any Λ -chain of the from ab = a b Λ a b Λ a b Λ . . . Λ a k b k − Λ a k b k = cd is a canonical Λ -chain. The next lemma extends an important known property of the forcing relation Γ for staticgraphs [24, Lemma 5.3] to the temporal case. ▶ Lemma 7 (Temporal Triangle Lemma) . Let ( G, λ ) be a temporal graph and with a syn-chronous triangle on the vertices a, b, c , where λ ( a, b ) = λ ( b, c ) = λ ( c, a ) = t . Let A, B, C bethree Λ -implication classes of ( G, λ ) , where ab ∈ C , bc ∈ A , and ca ∈ B , where A ̸ = B − and A ̸ = C − . If some b ′ c ′ ∈ A , then ab ′ ∈ C and c ′ a ∈ B . If some b ′ c ′ ∈ A and a ′ b ′ ∈ C , then c ′ a ′ ∈ B . No edge of A touches vertex a . Proof. 1.
Let b ′ c ′ ∈ A , and let bc = b c Λ b c Λ . . . Λ b k c k − Λ b k c k = b ′ c ′ be a canonicalΛ-chain from bc to b ′ c ′ . Thus note that all edges b i c i − and b i c i of this Λ-chain have thesame time-label t in ( G, λ ). We will prove by induction that ab i ∈ C and c i a ∈ B , forevery i = 0 , , . . . , k . The induction basis follows directly by the statement of the lemma,as ab = ab ∈ C and ca = c a ∈ B .Assume now that ab i ∈ C and c i a ∈ B . If b i +1 = b i then clearly ab i +1 ∈ C by theinduction hypothesis. Suppose now that b i +1 ̸ = b i . If { a, b i +1 } / ∈ E then ac i Λ b i +1 c i .Then, since c i a ∈ B and b i +1 c i ∈ A , it follows that A = B − , which is a contradiction tothe assumption of the lemma. Therefore { a, b i +1 } ∈ E . Furthermore, since b i c i Λ b i +1 c i ,it follows that either { b i , b i +1 } / ∈ E or λ ( b i , b i +1 ) < t . In either case it follows that ab i Λ ab i +1 , and thus ab i +1 ∈ C .Similarly, if c i +1 = c i then c i +1 a ∈ B by the induction hypothesis. Suppose nowthat c i +1 ̸ = c i . If { a, c i +1 } / ∈ E then ab i +1 Λ c i +1 b i +1 . Then, since ab i +1 ∈ C and b i +1 c i +1 ∈ A , it follows that A = C − , which is a contradiction to the assumption of thelemma. Therefore { a, c i +1 } ∈ E . Furthermore, since b i +1 c i Λ b i +1 c i +1 , it follows thateither { c i , c i +1 } / ∈ E or λ ( c i , c i +1 ) < t . In either case it follows that c i a Λ c i +1 a , andthus c i +1 a ∈ C . This completes the induction step. Let b ′ c ′ ∈ A and a ′ b ′ ∈ C . Then part 1 of the lemma implies that c ′ a ∈ B . Now let ab = a b Λ a b Λ . . . Λ a ℓ b ℓ − Λ a ℓ b ℓ = a ′ b ′ be a canonical Λ-chain from ab to a ′ b ′ .Again, note that all edges a i b i − and a i b i of this Λ-chain have the same time-label t in( G, λ ). We will prove by induction that c ′ a i ∈ B and b i c ′ ∈ A for every i = 0 , , . . . , k .First recall that c ′ a = c ′ a ∈ B . Furthermore, by applying part 1 of the proof to thetriangle with vertices a , b , c and on the edge c ′ a ∈ B , it follows that b c ′ ∈ A . Thiscompletes the induction basis.For the induction step, assume that c ′ a i ∈ B and b i c ′ ∈ A . If a i +1 = a i then clearly c ′ a i +1 ∈ B . Suppose now that a i +1 ̸ = a i . If { a i +1 , c ′ } / ∈ E then a i +1 b i Λ c ′ b i . Then,since a i +1 b i ∈ C and b i c ′ ∈ A , it follows that A = C − , which is a contradiction to theassumption of the lemma. Therefore { a i +1 , c ′ } ∈ E . Now, since a i b i Λ a i +1 b i , it followsthat either { a i , a i +1 } / ∈ E or λ ( a i , a i +1 ) < t . In either case it follows that c ′ a i Λ c ′ a i +1 .Therefore, since c ′ a i ∈ B , it follows that c ′ a i +1 ∈ B .If b i +1 = b i then clearly b i +1 c ′ ∈ A . Suppose now that b i +1 ̸ = b i . Then, since c ′ a i +1 ∈ B , a i +1 b i ∈ C , and b i c ′ ∈ A , we can apply part 1 of the lemma to the triangle with vertices a i +1 , b i , c ′ and on the edge a i +1 b i +1 ∈ C , from which it follows that b i c ′ ∈ A . Thiscompletes the induction step, and thus c ′ a k = c ′ a ′ ∈ B . Suppose that ad ∈ A (resp. da ∈ A ), for some vertex d . Then, by setting b ′ = a and c ′ = d (resp. b ′ = d and c ′ = a ), part 1 of the lemma implies that ab ′ = aa ∈ C (resp. c ′ a = aa ∈ B ). Thus is a contradiction, as the underlying graph G does not havethe edge aa . ◀ .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 11 Deciding temporal transitivity using Boolean satisfiability.
Starting with any undirectededge { u, v } of the underlying graph G , we can clearly enumerate in polynomial time thewhole Λ-implication class A to which the oriented edge uv belongs (cf. Equation (2)). Ifthe reversely directed edge vu ∈ A then Lemma 4 implies that A = A − = b A . Otherwise, if vu / ∈ A then vu ∈ A − and Lemma 4 implies that A ∩ A − = ∅ . Thus, we can also decide inpolynomial time whether A ∩ A − = ∅ . If we encounter at least one Λ-implication class A such that A ∩ A − ̸ = ∅ , then it follows by Lemma 5 that ( G, λ ) is not temporally transitivelyorientable.In the remainder of the section we will assume that A ∩ A − = ∅ for every Λ-implicationclass A of ( G, λ ), which is a necessary condition for (
G, λ ) to be temporally transitiveorientable. Moreover it follows by Lemma 5 that, if (
G, λ ) admits a temporally transitivelyorientation F , then either A ⊆ F or A − ⊆ F . This allows us to define a Boolean variable x A for every Λ-implication class A , where x A = x A − . Here x A = 1 (resp. x A − = 1) meansthat A ⊆ F (resp. A − ⊆ F ), where F is the temporally transitive orientation which we arelooking for. Let { A , A , . . . , A s } be a set of Λ-implication classes such that { c A , c A , . . . , c A s } is a partition of the edges of the underlying graph G . Then any truth assignment τ of thevariables x , x , . . . , x s (where x i = x A i for every i = 1 , , . . . , s ) corresponds bijectively toone possible orientation of the temporal graph ( G, λ ), in which every Λ-implication class isoriented consistently.Now we define two Boolean formulas ϕ and ϕ such that ( G, λ ) admits a temporaltransitive orientation if and only if there is a truth assignment τ of the variables x , x , . . . , x s such that both ϕ and ϕ are simultaneously satisfied. Here ϕ is a formula,i.e., the disjunction of clauses with three literals each, where every clause NAE ( ℓ , ℓ , ℓ ) issatisfied if and only if at least one of the literals { ℓ , ℓ , ℓ } is equal to 1 and at least oneof them is equal to 0. Furthermore ϕ is a 2SAT formula, i.e., the disjunction of 2CNFclauses with two literals each, where every clause ( ℓ ∨ ℓ ) is satisfied if and only if at leastone of the literals { ℓ , ℓ } is equal to 1. For simplicity of the presentation we also define avariable x uv for every directed edge uv . More specifically, if uv ∈ A i (resp. uv ∈ A − i ) thenwe set x uv = x i (resp. x uv = x i ). That is, x uv = x vu for every undirected edge { u, v } ∈ E .Note that, although { x uv , x vu : { u, v } ∈ E } are defined as variables, they can equivalently beseen as literals in a Boolean formula over the variables x , x , . . . , x s . The process of buildingall Λ-implication classes and all variables { x uv , x vu : { u, v } ∈ E } is given by Algorithm 1. Description of the 3NAE formula ϕ . Consider a synchronous triangle of (
G, λ ) onthe vertices u, v, w . First observe that, if at least one of the three equalities x uv = x wv ,or x vw = x uw , or x wu = x vu is true (or equivalently, if at least one of the pairs { uv, wv } , { vw, uw } , { wu, vu } of oriented edges belongs to the same Λ-implication class A i ), thenthe triangle on the vertices u, v, w is never cyclically oriented in any proper orientation F .Therefore, if x uv ̸ = x wv , x vw ̸ = x uw , and x wu ̸ = x vu , then we add to ϕ the clause NAE ( x uv , x vw , x wu ). Note that the triangle on u, v, w is transitively oriented if and only if NAE ( x uv , x vw , x wu ) is satisfiable, i.e., at least one of the variables { x uv , x vw , x wu } receivesthe value 1 and at least one of them receives the value 0. Description of the 2SAT formula ϕ . Consider a triangle of (
G, λ ) on the vertices u, v, w , where λ ( u, v ) = t , λ ( v, w ) = t , λ ( w, v ) = t , and t ≤ t ≤ t . If t < t = t then Here we slightly abuse the notation by identifying the undirected edge { u, v } with the set of both itsorientations { uv, vu } . Algorithm 1
Building the Λ-implication classes and the edge-variables.
Input:
A temporal graph (
G, λ ), where G = ( V, E ). Output:
The variables { x uv , x vu : { u, v } ∈ E } , or the announcement that ( G, λ ) is tempor-ally not transitively orientable. s ← E ← E while E ̸ = ∅ do s ← s + 1; Let { p, q } ∈ E be arbitrary Build the Λ-implication class A s of the oriented edge pq (by Equation (2)) if qp ∈ A s then { A s ∩ A − s ̸ = ∅ } return “NO” else x s is the variable corresponding to the directed edges of A s for every uv ∈ A s do x uv ← x s ; x vu ← x s { x uv and x vu become aliases of x s and x s } E ← E \ c A s return Λ-implication classes { A , A , . . . , A s } and variables { x uv , x vu : { u, v } ∈ E } we add to ϕ the clauses ( x uw ∨ x wv ) ∧ ( x vw ∨ x wu ); note that these clauses are equivalentto x wu = x wv . If t ≤ t < t then we add to ϕ the clauses ( x wv ∨ x uw ) ∧ ( x uv ∨ x wu );note that these clauses are equivalent to ( x vw ⇒ x uw ) ∧ ( x vu ⇒ x wu ). Now consider a pathof length 2 that is induced by the vertices u, v, w , where λ ( u, v ) = t , λ ( v, w ) = t , and t ≤ t . If t = t then we add to ϕ the clauses ( x vu ∨ x wv ) ∧ ( x vw ∨ x uv ); note thatthese clauses are equivalent to ( x uv = x wv ). Finally, if t < t then we add to ϕ theclause ( x vu ∨ x wv ); note that this clause is equivalent to ( x uv ⇒ x wv ).By slightly abusing the notation, we say that ϕ ∧ ϕ is satisfiable if and onlyif there exists a truth assignment τ which simultaneously satisfies both ϕ and ϕ .Given the above definitions of ϕ and ϕ , it is easy to check that their clauses modelall conditions of the oriented edges imposed by the row of “ TTO ” in Table 1. Therefore weobtain that the temporal graph (
G, λ ) is transitively orientable if and only if ϕ ∧ ϕ is satisfiable.Although deciding whether ϕ is satisfiable can be done in linear time with respectto the size of the formula [6], the problem Not-All-Equal-3-SAT is NP-complete [42]. Weovercome this problem and present a polynomial-time algorithm for deciding whether ϕ ∧ ϕ is satisfiable as follows. In the initialization phase , we exhaustively check which truthvalues are forced in ϕ ∧ ϕ by using Initial-Forcing (see Algorithm 2) as asubroutine. During the execution of
Initial-Forcing , we either replace the formulas ϕ and ϕ by the equivalent formulas ϕ (0)3NAE and ϕ (0)2SAT , respectively, or we reach acontradiction by showing that ϕ ∧ ϕ is unsatisfiable. Clearly, we have the following. ▶ Observation 8.
The temporal graph ( G, λ ) is transitively orientable if and only if ϕ (0) ∧ ϕ (0) is satisfiable. The main phase of the algorithm starts once the formulas ϕ (0)3NAE and ϕ (0)2SAT have beencomputed. During this phase, we iteratively modify the formulas such that, at the end ofiteration j we have the formulas ϕ ( j )3NAE and ϕ ( j )2SAT . As we prove, ϕ ( j − ∧ ϕ ( j − is satisfiableif and only if ϕ ( j )3NAE ∧ ϕ ( j )2SAT is satisfiable. Note that, during the execution of the algorithm,we can both add clauses to and remove clauses from ϕ ( j )2SAT . On the other hand, we can only .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 13 remove clauses from ϕ ( j )3NAE .For the remainder of the section we write x ab ∗ ⇒ ϕ x uv (resp. x ab ∗ ⇒ ϕ ( j )2SAT x uv ) if thetruth assignment x ab = 1 forces the truth assignment x uv = 1 from the clauses of ϕ (resp. of ϕ ( j )2SAT at the iteration j of the algorithm); in this case we say that x ab implies x uv in ϕ (resp. in ϕ ( j )2SAT ).We next introduce the notion of uncorrelated triangles, which lets us formulate someimportant properties of the implications in ϕ and ϕ (0)2SAT . ▶ Definition 9.
Let u, v, w induce a synchronous triangle in ( G, λ ) , where each of the variablesof the set { x uv , x vu , x vw , x wv , x wu , x uw } belongs to a different Λ -implication class. If none of the variables of the set { x uv , x vu , x vw , x wv , x wu , x uw } implies any other variable of thesame set in the formula ϕ (resp. in the formula ϕ (0) ), then the triangle of u, v, w is ϕ -uncorrelated (resp. ϕ (0)2SAT -uncorrelated ). Now we present two crucial technical lemmas which prove some crucial structural prop-erties of the 2SAT formulas ϕ and ϕ (0)2SAT . These structural properties will allow us toprove the correctness of our main algorithm in this section (Algorithm 4). In a nutshell, thesetwo lemmas guarantee that, whenever we have specific implications in ϕ (resp. in ϕ (0)2SAT ),then we also have some specific other implications in the same formula. ▶ Lemma 10.
Let u, v, w induce a synchronous and ϕ -uncorrelated triangle in ( G, λ ) ,and let { a, b } ∈ E be an edge of G such that { a, b } ∩ { u, v, w } ≤ . If x ab ∗ ⇒ ϕ x uv , then x ab also implies at least one of the four variables in the set { x vw , x wv , x uw , x wu } in ϕ . Proof.
Let t be the common time-label of all the edges in the synchronous triangle of thevertices u, v, w . That is, λ ( u, v ) = λ ( v, w ) = λ ( w, u ) = t . Denote by A , B , and C theΛ-implication classes in which the directed edges uv , vw , and wu belong, respectively. Let x ab = x a b ⇒ ϕ x a b ⇒ ϕ . . . ⇒ ϕ x a k − b k − ⇒ ϕ x a k b k = x uv be a ϕ -implication chain from x ab to x uv . Note that, without loss of generality, for each variable x a i b i in this chain, the directed edge a i b i is a representative of a different Λ-implication classthan all other directed edges in the chain (otherwise we can just shorten the ϕ -implicationchain from x ab to x uv ). Furthermore, since x a k b k = x uv , note that a k b k and uv are bothrepresentatives of the same Λ-implication class A . Therefore Lemma 7 (the temporal trianglelemma) implies that wa k ∈ C and b k w ∈ B . Therefore we can assume without loss ofgenerality that u = a k and v = b k . Moreover, let A ′ / ∈ { A, A − , B, B − , C, C − } be the Λ-implication class in which the directed edge a k − b k − belongs. Since x a k − b k − ⇒ ϕ x a k b k ,note that without loss of generality we can choose the directed edge a k − b k − to be such arepresentative of the Λ-implication class A ′ such that either a k − = a k or b k − = b k . Wenow distinguish these two cases. Case 1: u = a k = a k − and v = b k ̸ = b k − . Then, since x a k − b k − = x a k b k − ⇒ ϕ x a k b k = x uv and λ ( a k , b k ) = t , it follows that λ ( u, b k − ) ≥ t + 1. Suppose that { w, b k − } / ∈ E .Then x ub k − ⇒ ϕ x uw , which proves the lemma. Now suppose that { w, b k − } ∈ E . If λ ( w, b k − ) ≤ λ ( u, b k − ) − x ub k − ⇒ ϕ x uw , which proves the lemma. Suppose that λ ( w, b k − ) ≥ λ ( u, b k − )+1. Then x ub k − ⇒ ϕ x wb k − ⇒ ϕ x wu , i.e. x ub k − ∗ ⇒ ϕ x wu ,which again proves the lemma. Suppose finally that λ ( w, b k − ) = λ ( u, b k − ). Then, since λ ( u, w ) = t < λ ( w, b k − ) = λ ( u, b k − ), it follows that wb k − Λ ub k − . If { v, b k − } / ∈ E then x ub k − = x wb k − ⇒ ϕ x wv , which proves the lemma. Now let { v, b k − } ∈ E . If λ ( v, b k − ) ≤ λ ( w, b k − ) − x ub k − = x wb k − ⇒ ϕ x wv , which proves the lemma.If λ ( v, b k − ) ≥ λ ( w, b k − ) + 1 then x ub k − = x wb k − ⇒ ϕ x vb k − ⇒ ϕ x wv , which proves the lemma. If λ ( v, b k − ) = λ ( w, b k − ) then ub k − Λ vb b − , and thus x ub k − = x a k − b k − ⇏ ϕ x a k b k = x uv , which is a contradiction. Case 2: u = a k ̸ = a k − and v = b k = b k − . Then, since x a k − b k − = x a k − b k ⇒ ϕ x a k b k = x uv and λ ( a k , b k ) = t , it follows that λ ( v, a k − ) ≤ t −
1. Suppose that { w, a k − } / ∈ E .Then x a k − v ⇒ ϕ x wv , which proves the lemma. Now suppose that { w, a k − } ∈ E .If λ ( w, a k − ) ≤ t − x a k − v ⇒ ϕ x wv , which proves the lemma. Suppose that λ ( w, a k − ) = t . Then, since λ ( v, a k − ) ≤ t −
1, it follows that vw Λ a t − w . If { u, a k − } / ∈ E then also a t − w Λ uw , and thus x wv = x wu , which is a contradiction to the assumptionthat the triangle of u, v, w is uncorrelated. Thus { u, a k − } ∈ E . If λ ( u, a k − ) ≤ t − a t − w Λ uw , which is a contradiction. On the other hand, if λ ( u, a k − ) ≥ t then x a k − v = x a k − b k − ⇏ ϕ x a k b k = x uv , which is a contradiction.Finally suppose that λ ( w, a k − ) ≥ t + 1. Then, since λ ( v, w ) = t and λ ( v, a k − ) ≤ t − x vw ⇒ ϕ x a k − w ⇒ ϕ x a k − v . However, since x a k − v = x a k − b k ⇒ ϕ x a k b k = x uv , it follows that x vw ∗ ⇒ ϕ x uv , which is a contradiction to the assumption thatthe triangle of u, v, w is uncorrelated. ◀▶ Lemma 11.
Let u, v, w induce a synchronous and ϕ (0) -uncorrelated triangle in ( G, λ ) ,and let { a, b } ∈ E be an edge of G such that { a, b } ∩ { u, v, w } ≤ . If x ab ∗ ⇒ ϕ (0) x uv , then x ab also implies at least one of the four variables in the set { x vw , x wv , x uw , x wu } in ϕ (0) . Proof.
Assume we have { a, b } ∩ { u, v, w } ≤ x ab ∗ ⇒ ϕ (0)2SAT x uv . Then we make a casedistinction on the last implication in the implication chain x ab ∗ ⇒ ϕ (0)2SAT x uv . The last implication is an implication from ϕ , i.e., x ab ∗ ⇒ ϕ (0)2SAT x pq ⇒ ϕ x uv . If { p, q } ⊆ { u, v, w } then we are done, since we can assume that { p, q } ̸ = { u, v } becauseno such implications are contained in ϕ . Otherwise Lemma 10 implies that x pq alsoimplies at least one of the four variables in the set { x vw , x wv , x uw , x wu } in ϕ . If followsthat x ab also implies at least one of the four variables in the set { x vw , x wv , x uw , x wu } in ϕ (0)2SAT . The last implication is not an implication from ϕ , i.e., x ab ∗ ⇒ ϕ (0)2SAT x pq ⇒ ϕ INIT x uv ,there the implication x pq ⇒ ϕ INIT x uv was added to ϕ (0)2SAT by Initial-Forcing . If x pq ⇒ ϕ INIT x uv was added in Line 7 or Line 10 of Initial-Forcing , then we have that { p, q } ⊆ { u, v, w } and { p, q } ̸ = { u, v } , hence the u, v, w is not a ϕ (0)2SAT -uncorrelatedtriangle, a contradiction. If x pq ⇒ ϕ INIT x uv was added in Line 14 of Initial-Forcing ,then we have that x pq ⇒ ϕ INIT x uw , hence we are done. ◀ The algorithm.
We are now ready to present our polynomial-time algorithm (Algorithm 4)for deciding whether a given temporal graph (
G, λ ) is temporally transitively orientable. Themain idea of our algorithm is as follows. First, the algorithm computes all Λ-implicationclasses A , . . . , A s by calling Algorithm 1 as a subroutine. If there exists at least one Λ-implication class A i where uv, vu ∈ A i for some edge { u, v } ∈ E , then we announce that( G, λ ) is a no -instance, due to Lemma 5. Otherwise we associate to each Λ-implication class A i a variable x i , and we build the formula ϕ and the 2SAT formula ϕ , asdescribed in Section 3.1.In the initialization phase of Algorithm 4 we build the formulas ϕ (0)3NAE and ϕ (0)2SAT bychecking which truth values are being forced in ϕ ∧ ϕ . Furthermore, we if x ⇒ ϕ (0)2SAT a and x ⇒ ϕ (0)2SAT b , and we have that NAE ( a, b, c ) ∈ ϕ (0)3NAE , then we add x ⇒ ϕ (0)2SAT c to ϕ (0)2SAT , .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 15 since clearly, if x = 1 then a = b = 1 and we have to set c = 0 to satisfy the NAEclause NAE ( a, b, c ). This is done by calling algorithm Initial-Forcing (see Algorithm 2) as asubroutine. The main idea of
Initial-Forcing is that, whenever setting x i = 1 (resp. x i = 0)forces ϕ ∧ ϕ to become unsatisfiable, we choose to set x i = 0 (resp. x i = 1).The main phase of the algorithm starts once the formulas ϕ (0)3NAE and ϕ (0)2SAT have beencomputed. Then we iteratively try assigning to each variable x i the truth value 1 or 0.Once we have set x i = 1 (resp. x i = 0) during the iteration j ≥ Boolean-Forcing (see Algorithm 3) as a subroutine to check which implicationsthis value of x i has on the current formulas ϕ ( j − and ϕ ( j − and which other truth valuesof variables are forced. The correctness of Boolean-Forcing can be easily verified bychecking all subcases of
Boolean-Forcing . During the execution of
Boolean-Forcing ,we either replace the current formulas by ϕ ( j )3NAE and ϕ ( j )2SAT , or we reach a contradiction byshowing that, setting x i = 1 (resp. x i = 0) makes ϕ ( j − ∧ ϕ ( j − unsatisfiable. If each of thetruth assignments { x i = 1 , x i = 0 } leads to such a contradiction, we return that ( G, λ ) is a no -instance. Otherwise, if at least one of the truth assignments { x i = 1 , x i = 0 } does not leadto such a contradiction, we follow this truth assignment and proceed with the next variable.We prove that, if we manage to sequentially assign to each variable a truth value withoutreaching a contradiction, the resulting truth assignment of x , . . . , x s naturally defines atemporal transitive orientation F of ( G, λ ).We now prove formally that Algorithm 4 is correct. More specifically, we show that ifAlgorithm 4 gets a yes -instance as input then it outputs a temporally transitive orientation,while if it gets a no -instance as input then it outputs “NO”. We start by proving in thefollowing auxiliary lemma that, if the algorithm returns “NO” at the j th iteration, then theformula ϕ ( j − ∧ ϕ ( j − of the previous iteration is not satisfiable. ▶ Lemma 12.
For every iteration j of Algorithm 4, if Algorithm 4 returns “NO” in Line 16,then ϕ ( j − ∧ ϕ ( j − is not satisfiable. Proof.
Assume otherwise that ϕ ( j − ∧ ϕ ( j − is satisfiable, and let x i be the variable of ϕ ( j − ∧ ϕ ( j − that is considered by the algorithm at iteration j . Let τ be a satisfying truthassignment of ϕ ( j − ∧ ϕ ( j − . If x i = 1 (resp. x i = 0) in τ then the algorithm will proceedby computing the next formula ϕ ( j )3NAE ∧ ϕ ( j )2SAT in Line 11 (resp. in Line 14) and thus it willnot return “NO” in Line 16, which is a contradiction. ◀ The next crucial observation follows immediately by the construction of ϕ in Sec-tion 3.1, and by the fact that, at every iteration j , Algorithm 4 can only remove clauses from ϕ ( j − . ▶ Observation 13.
If Algorithm 3 removes a clause from ϕ ( j − , then this clause is satisfiedfor all satisfying assignments of ϕ ( j ) . Next, we prove a crucial insight about the Boolean forcing steps in the main phase ofAlgorithm 4. This will allow us to assume that whenever a clause is added to the 2SAT partof the formula in the main phase of the algorithm, then we have set one variable of a NAEclause to some truth value. ▶ Lemma 14.
Whenever
Boolean-Forcing (Algorithm 3) is called in an iteration j ≥ (i.e. in the main phase) of Algorithm 4, Lines 11 and 12 of Boolean-Forcing are notexecuted if this call of
Boolean-Forcing does not output “NO”.
Algorithm 2
Initial-Forcing
Input:
A 2-SAT formula ϕ and a 3-NAE formula ϕ Output:
A 2-SAT formula ϕ (0)2SAT and a 3-NAE formula ϕ (0)3NAE such that ϕ (0)2SAT ∧ ϕ (0)3NAE is satisfiable if and only if ϕ ∧ ϕ is satisfiable, or the announcement that ϕ ∧ ϕ is not satisfiable. ϕ (0)3NAE ← ϕ ; ϕ (0)2SAT ← ϕ {initialization} for every variable x i appearing in ϕ (0)3NAE ∧ ϕ (0)2SAT do if Boolean-Forcing (cid:16) ϕ (0)3NAE , ϕ (0)2SAT , x i , (cid:17) = “NO” then if Boolean-Forcing (cid:16) ϕ (0)3NAE , ϕ (0)2SAT , x i , (cid:17) = “NO” then return “NO” {both x i = 1 and x i = 0 invalidate the formulas} else (cid:16) ϕ (0)3NAE , ϕ (0)2SAT (cid:17) ← Boolean-Forcing (cid:16) ϕ (0)3NAE , ϕ (0)2SAT , x i , (cid:17) else if Boolean-Forcing (cid:16) ϕ (0)3NAE , ϕ (0)2SAT , x i , (cid:17) = “NO” then (cid:16) ϕ (0)3NAE , ϕ (0)2SAT (cid:17) ← Boolean-Forcing (cid:16) ϕ (0)3NAE , ϕ (0)2SAT , x i , (cid:17) for every clause NAE ( x uv , x vw , x wu ) of ϕ (0)3NAE do for every variable x ab do if x ab ∗ ⇒ ϕ (0)2SAT x uv and x ab ∗ ⇒ ϕ (0)2SAT x vw then {add ( x ab ⇒ x uw ) to ϕ (0)2SAT } ϕ (0)2SAT ← ϕ (0)2SAT ∧ ( x ba ∨ x uw ) Repeat lines 2 and 11 until no changes occur on ϕ (0)2SAT and ϕ (0)3NAE return (cid:16) ϕ (0)3NAE , ϕ (0)2SAT (cid:17) Proof.
Assume for contradiction that Lines 11 and 12 of Algorithm 3 are executed in iteration j of Algorithm 4 and Algorithm 3 does not output “NO”. Let j be the first iteration wherethis happens. This means that there is a clause NAE ( x uv , x vw , x wu ) of ϕ ′ and an implication x uv ∗ ⇒ ϕ ′ x vw during the execution of Algorithm 3. Let NAE ( x uv , x vw , x wu ) and x uv ∗ ⇒ ϕ ′ x vw appear in the first execution of Lines 11 and 12 of Algorithm 3.We first partition the implication chain x uv ∗ ⇒ ϕ ′ x vw into “old” and “new” implications,where “old” implications are contained in ϕ (0)2SAT and all other implications (that were addedin previous iterations) are considered “new”. If there are several NAE clauses and implicationchains that fulfill the condition in Line 9 of Algorithm 3, we assume that x uv ∗ ⇒ ϕ ′ x vw isone that contains a minimum number of “new” implications. Observe that since we assume x uv ∗ ⇒ ϕ ′ x vw is a condition for the first execution of Lines 11 and 12 of Algorithm 3, itfollows that all “new” implications in x uv ∗ ⇒ ϕ ′ x vw were added in Line 17 or Line 19 ofAlgorithm 3 in previous iterations.Note that by definition of ϕ (0)2SAT , we know that x uv ∗ ⇒ ϕ ′ x vw contains at least one“new” implication. Furthermore, we can observe that x uv ∗ ⇒ ϕ ′ x vw contains at least two .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 17 Algorithm 3
Boolean-Forcing
Input:
A 2-SAT formula ϕ , a 3-NAE formula ϕ , and a variable x i of ϕ ∧ ϕ , and a truthvalue Value ∈ { , } Output:
A 2-SAT formula ϕ ′ and a 3-NAE formula ϕ ′ , obtained from ϕ and ϕ by setting x i = Value , or the announcement that x i = Value does not satisfy ϕ ∧ ϕ . ϕ ′ ← ϕ ; ϕ ′ ← ϕ while ϕ ′ has a clause ( x uv ∨ x pq ) and x uv = 1 do Remove the clause ( x uv ∨ x pq ) from ϕ ′ while ϕ ′ has a clause ( x uv ∨ x pq ) and x uv = 0 do if x pq = 0 then return “NO” Remove the clause ( x uv ∨ x pq ) from ϕ ′ ; x pq ← for every variable x uv that does not yet have a truth value do if x uv ∗ ⇒ ϕ ′′ x vu , where ϕ ′′ = ϕ ′ \ ϕ then x uv ← for every clause NAE ( x uv , x vw , x wu ) of ϕ ′ do {synchronous triangle on vertices u, v, w } if x uv ∗ ⇒ ϕ ′ x vw then {add ( x uv ⇒ x uw ) ∧ ( x uw ⇒ x vw ) to ϕ ′ } ϕ ′ ← ϕ ′ ∧ ( x vu ∨ x uw ) ∧ ( x wu ∨ x vw ) Remove the clause
NAE ( x uv , x vw , x wu ) from ϕ ′ if x uv already got the value 1 or 0 then Remove the clause
NAE ( x uv , x vw , x wu ) from ϕ ′ if x vw and x wu do not have yet a truth value then if x uv = 1 then {add ( x vw ⇒ x uw ) to ϕ ′ } ϕ ′ ← ϕ ′ ∧ ( x wv ∨ x uw ) else { x uv = 0; in this case add ( x uw ⇒ x vw ) to ϕ ′ } ϕ ′ ← ϕ ′ ∧ ( x wu ∨ x vw ) if x vw = x uv and x wu does not have yet a truth value then x wu ← − x uv if x vw = x wu = x uv then return “NO” Repeat lines 2, 4, 7, and 9 until no changes occur on ϕ ′ and ϕ ′ if both x uv = 0 and x uv = 1 for some variable x uv then return “NO” return ( ϕ ′ , ϕ ′ )implications overall.We first consider the case that x uv ∗ ⇒ ϕ ′ x vw contains at least one “old” implication. Weassume w.l.o.g. that x uv ∗ ⇒ ϕ ′ x vw contains an “old” implication that is directly followed bya “new” implication (if this is not the case, then we can consider the contraposition of theimplication chain).Note that since the “new” implication was added in Line 17 or Line 19 of Algorithm 3,we can assume w.l.o.g that the “new” implication is x ab ⇒ BF x cb and that x ca = 1 for somesynchronous triangle on the vertices a, b, c , that is, we have NAE ( x ab , x bc , x ca ) ∈ ϕ (0)3NAE (thisis the Line 17 case, Line 19 works analogously). Let x pq ⇒ ϕ (0)2SAT x ab be the “old” implication. Algorithm 4
Temporal transitive orientation.
Input:
A temporal graph (
G, λ ), where G = ( V, E ). Output:
A temporal transitive orientation F of ( G, λ ), or the announcement that (
G, λ ) istemporally not transitively orientable. Execute Algorithm 1 to build the Λ-implication classes { A , A , . . . , A s } and the Booleanvariables { x uv , x vu : { u, v } ∈ E } if Algorithm 1 returns “NO” then return “NO” Build the formula ϕ and the 2SAT formula ϕ if Initial-Forcing ( ϕ , ϕ ) ̸ = “NO” then {Initialization phase} (cid:16) ϕ (0)3NAE , ϕ (0)2SAT (cid:17) ← Initial-Forcing ( ϕ , ϕ ) else { ϕ ∧ ϕ leads to a contradiction} return “NO” j ← F ← ∅ {Main phase} while a variable x i appearing in ϕ ( j − ∧ ϕ ( j − did not yet receive a truth value do if Boolean-Forcing (cid:16) ϕ ( j − , ϕ ( j − , x i , (cid:17) ̸ = “NO” then (cid:16) ϕ ( j )3NAE , ϕ ( j )2SAT (cid:17) ← Boolean-Forcing (cid:16) ϕ ( j − , ϕ ( j − , x i , (cid:17) else { x i = 1 leads to a contradiction} if Boolean-Forcing (cid:16) ϕ ( j − , ϕ ( j − , x i , (cid:17) ̸ = “NO” then (cid:16) ϕ ( j )3NAE , ϕ ( j )2SAT (cid:17) ← Boolean-Forcing (cid:16) ϕ ( j − , ϕ ( j − , x i , (cid:17) else return “NO” j ← j + 1 for i = 1 to s do if x i did not yet receive a truth value then x i ← if x i = 1 then F ← F ∪ A i else F ← F ∪ A i return the temporal transitive orientation F of ( G, λ )Then we have that x pq ⇒ ϕ (0)2SAT x ab ⇒ BF x cb is contained in x uv ∗ ⇒ ϕ ′ x vw . Furthermore, bydefinition of ϕ (0)2SAT , we have that |{ p, q } ∩ { a, b, c }| ≤
1, hence we can apply Lemma 11 andobtain one of the following four scenarios: x pq ⇒ ϕ (0)2SAT x cb :In this case we can replace x pq ⇒ ϕ (0)2SAT x ab ⇒ BF x cb with x pq ⇒ ϕ (0)2SAT x cb in the implicationchain x uv ∗ ⇒ ϕ ′ x vw to obtain an implication chain from x uv to x vw with strictly fewer“new” implications, a contradiction. x pq ⇒ ϕ (0)2SAT x bc :Now we have that x pq ⇒ ϕ (0)2SAT x ab and x pq ⇒ ϕ (0)2SAT x bc . Then by definition of ϕ (0)2SAT we alsohave that x pq ⇒ ϕ (0)2SAT x ac and hence x ca ⇒ ϕ (0)2SAT x qp . Recall that we know that x ca = 1. Itfollows that x pq = 0 in iteration j , a contradiction to the assumption that x uv ∗ ⇒ ϕ ′ x vw .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 19 exists. x pq ⇒ ϕ (0)2SAT x ca :Now we have that x pq ⇒ ϕ (0)2SAT x ab and x pq ⇒ ϕ (0)2SAT x ca . Then by definition of ϕ (0)2SAT we alsohave that x pq ⇒ ϕ (0)2SAT x cb . From here it is the same as case 1. x pq ⇒ ϕ (0)2SAT x ac : Same as case 2.Hence, we have a contradiction in every case and can conclude that x uv ∗ ⇒ ϕ ′ x vw does notcontain any “old” implications.Now consider the case that x uv ∗ ⇒ ϕ ′ x vw only contains “new” implications. We firstassume that x uv ∗ ⇒ ϕ ′ x vw contains exactly two “new” implications. Then the first implicationis either x uv ⇒ BF x wv or x uv ⇒ BF x uw . Note that we cannot add the implication x wv ⇒ x vw in Boolean-Forcing , hence the first implication has to be x uv ⇒ BF x uw which implies that x vw = 1, which is a contradiction to the existence of the implication chain x uv ∗ ⇒ ϕ ′ x vw .From now on we assume that x uv ∗ ⇒ ϕ ′ x vw contains strictly more than two implications.Consider two consecutive BF implications in x uv ∗ ⇒ ϕ ′ x vw . Denote these two implicationsby x ab ⇒ BF x cd and x cd ⇒ BF x fg . By the Boolean-Forcing algorithm, we have thateither b = d or a = c , and in both cases the edges ab and cd belong to a synchronoustriangle. Suppose that b = d (the case a = c can be treated analogously), i.e., we havethe implication x ab ⇒ BF x cb . Let a, b, c be the vertices of the synchronous triangle for thisimplication. Similarly, for the implication x cd = x cb ⇒ BF x fg we know that either b = g or c = f . Suppose that b = g (the case c = f can be treated analogously), i.e., we havethe implication x cb ⇒ BF x fb . Let f ′ , c ′ , b ′ be the vertices of the synchronous triangle forthis implication; that is, the edges cb and c ′ b ′ are both representatives of the Λ-implicationclass of the variable x cb . Therefore Lemma 7 (the temporal triangle lemma) implies that ab ′ (resp. ac ′ ) exists in the graph and belongs to the same Λ-implication class of ab (resp. ac ).Therefore we can assume without loss of generality that b = b ′ and c = c ′ . Summarizing, wehave a synchronous triangle on the vertices a, b, c and another synchronous triangle b, c, f ′ .For convenience of the presentation, in the remainder of the proof we rename f ′ to d ; that is,the two synchronous triangles from the two consecutive BF implications are on the vertices a, b, c and b, c, d , respectively. Note that both of these triangles must be also synchronous toeach other, i.e., all their edges have the same time label t , see Figure 2 (a).We now have the following cases for the two consecutive implications: (A) x ab ⇒ BF x cb ⇒ BF x cd is contained in x uv ∗ ⇒ ϕ ′ x vw and x ca = 1 and x bd = 1 (Figure 2 (b)). (B) x ca ⇒ BF x cb ⇒ BF x cd is contained in x uv ∗ ⇒ ϕ ′ x vw and x ab = 1 and x bd = 1 (Figure 2 (c)).All other cases are symmetric to one of the two cases above. We now make a case-distinctionon the (possibly missing) edge { a, d } (dash-dotted green line in Figure 2). Cf. Table 1 forthe following cases. { a, d } is a non-edge or λ ( a, d ) < t : (A) In this case ϕ (0)2SAT by definition then contains x bd ⇒ ϕ (0)2SAT x ba . Hence, we have that x ab = 0, a contradiction to the assumption that x ab ⇒ BF x cb ⇒ BF x cd is contained in x uv ∗ ⇒ ϕ ′ x vw . (B) Contradiction since ϕ (0)2SAT by definition then contains x ab ⇒ ϕ (0)2SAT x db . λ ( a, d ) > t : (A) In this case ϕ (0)2SAT by definition then contains x ca ⇒ ϕ (0)2SAT x da and x bd ⇒ ϕ (0)2SAT x ad , acontradiction. (B) In this case we know that x ad = 1, since by definition ϕ (0)2SAT then contains x bd ⇒ ϕ (0)2SAT x ad . Furthermore, ϕ (0)2SAT by definition then contains x ad ⇒ ϕ (0)2SAT x ac and b cad (a) t tt tt b cad (b) t t ttt b cad (c) ttttt Figure 2
Illustration of the scenario of two consecutive “new” BF implications (a) appearing inthe proof of Lemma 14. The green dash-dotted line indicates that edge { a, d } may exist with sometime label or not. The proof makes a case distinction here. Subfigure (b) illustrates the case that x ab ⇒ BF x cb ⇒ BF x cd and x ca = x bd = 1, indicated by the red arrows. Subfigure (c) illustrates thecase that x ca ⇒ BF x cb ⇒ BF x cd and x ab = x bd = 1, indicated by the red arrows. hence we have x ca = 0, a contradiction to the assumption that x ca ⇒ BF x cb ⇒ BF x cd is contained in x uv ∗ ⇒ ϕ ′ x vw . λ ( a, d ) = t :Note that the above two cases do not apply, we can assume that all pairs of consecutiveimplication appearing in x uv ∗ ⇒ ϕ ′ x vw fall into this case. In particular, also the first one.Hence, we have that x uv ⇒ BF x pv ∗ ⇒ BF x vw or x uv ⇒ BF x up ∗ ⇒ BF x vw .Assume that x uv ⇒ BF x pv ∗ ⇒ BF x vw . Then in particular, using Lemma 7 (the temporaltriangle lemma) similarly as described above, we get that vertices p, v, w induce asynchronous triangle and NAE ( x pv , x vw , x wp ) ∈ ϕ (0)3NAE . Hence, x pv ∗ ⇒ BF x vw is animplication chain that fulfills the condition in Line 9 but contains less “new” implicationthan x uv ∗ ⇒ ϕ ′ x vw , a contradiction.Now assume that x uv ⇒ BF x up ∗ ⇒ BF x vw . Then we have that x vp = 1, otherwise theimplication x uv ⇒ BF x up would not have been added by Algorithm 3. In this case we alsoconsider the second implication in the chain. There are two cases: x uv ⇒ BF x up ⇒ BF x uq ∗ ⇒ BF x vw and x pb = 1. Since we have both x vp = 1 and x pq = 1,we have that Algorithm 3 also sets x vq = 1. It follows that we have that x uv ⇒ BF x uq and hence x uv ⇒ BF x uq ∗ ⇒ BF x vw , an implication chain that fulfills the condition inLine 9 but contains less “new” implication than x uv ∗ ⇒ ϕ ′ x vw , a contradiction. x uv ⇒ BF x up ⇒ BF x qp ∗ ⇒ BF x vw and x qu = 1. In this case we also have x uv ⇒ BF x bv and x qv ⇒ BF x qp . Hence, we have an alternative implication chain x uv ⇒ BF x qv ⇒ BF x qp ∗ ⇒ BF x vw that fulfills the condition in Line 9 of the same length. Now if { q, w } is a non-edge, λ ( q, w ) < t , or λ ( q, w ) > t , then one of the previous cases applies to the newimplication chain and we get a contradiction. Hence, assume that λ ( q, w ) = t . Then(using Lemma 7) we have that vertices q, v, w induce a synchronous triangle and NAE ( x qv , x vw , x wq ) ∈ ϕ (0)3NAE . It follows that x qv ⇒ BF x qp ∗ ⇒ BF x vw is an implicationchain that fulfills the condition in Line 9 but contains less “new” implication than x uv ∗ ⇒ ϕ ′ x vw , a contradiction.This finished the proof. ◀ We next show that for all iterations the 2SAT part of the formula does not contain animplication chain from a variable to its negation or vice versa. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 21 ▶ Lemma 15.
For every iteration j of Algorithm 4 we have that if ϕ ( j − ∧ ϕ ( j − is satisfiableand there is no x uv in ϕ ( j − such that x uv ∗ ⇒ ϕ ( j − x vu , then there is no x uv in ϕ ( j ) suchthat x uv ∗ ⇒ ϕ ( j ) x vu . Proof.
By Lemma 12 we have that if ϕ ( j − ∧ ϕ ( j − is satisfiable, then ϕ ( j )2SAT is well-defined.Assume for contradiction that there is no x uv in ϕ ( j − such that x uv ∗ ⇒ ϕ ( j − x vu but wehave a x uv in ϕ ( j )2SAT such that x uv ∗ ⇒ ϕ ( j )2SAT x vu .Then we can partition the implication chain x uv ∗ ⇒ ϕ ( j )2SAT x vu into “old” parts, that arealso present in ϕ (0)2SAT and “new” implications, that were added by Boolean-Forcing duringsome iteration j ′ ≤ j .Note that x uv ∗ ⇒ ϕ ( j )2SAT x vu contains at least one “new” implication. Consider an “old”implication in the implication chain followed by a “new” implication (if there is none,then there is one in the contraposition of the implication chain). By Lemma 14 the “new”implication was added by Algorithm 3 in Line 17 or Line 19. We can assume w.l.o.g thatthe “new” implication is x ab ⇒ BF x cb and that x ca = 1 for some synchronous triangle onthe vertices a, b, c , that is, we have NAE ( x ab , x bc , x ca ) ∈ ϕ (0)3NAE (this is the Line 17 case,Line 19 works analogously). Let x pq ⇒ ϕ (0)2SAT x ab be the “old” implication. Then we have that x pq ⇒ ϕ (0)2SAT x ab ⇒ BF x cb is contained in x uv ∗ ⇒ ϕ ( j )2SAT x vw . Furthermore, by definition of ϕ (0)2SAT ,we have that |{ p, q } ∩ { a, b, c }| ≤
1, hence we can apply Lemma 11 and obtain one of thefollowing four scenarios: x pq ⇒ ϕ (0)2SAT x cb :In this case we can replace x pq ⇒ ϕ (0)2SAT x ab ⇒ BF x cb with x pq ⇒ ϕ (0)2SAT x cb in the implicationchain x uv ∗ ⇒ ϕ ( j )2SAT x vw to obtain an implication chain from x uv to x vw with strictly fewer“new” implications, a contradiction. x pq ⇒ ϕ (0)2SAT x bc :Now we have that x pq ⇒ ϕ (0)2SAT x ab and x pq ⇒ ϕ (0)2SAT x bc . Then by definition of ϕ (0)2SAT we alsohave that x pq ⇒ ϕ (0)2SAT x ac and hence x ca ⇒ ϕ (0)2SAT x qp . Recall that we know that x ca = 1. Itfollows that x pq = 0 in iteration j , a contradiction to the assumption that x uv ∗ ⇒ ϕ ( j )2SAT x vw exists. x pq ⇒ ϕ (0)2SAT x ca :Now we have that x pq ⇒ ϕ (0)2SAT x ab and x pq ⇒ ϕ (0)2SAT x ca . Then by definition of ϕ (0)2SAT we alsohave that x pq ⇒ ϕ (0)2SAT x cb . From here it is the same as case 1. x pq ⇒ ϕ (0)2SAT x ac : Same as case 2. ◀ Now we are ready to show that if Algorithm 4 gets a yes -instance as input, it will computea valid orientation. ▶ Lemma 16.
For every iteration j of Algorithm 4 we have that if ϕ ( j − ∧ ϕ ( j − is satisfiableand there is no x uv in ϕ ( j − such that x uv ∗ ⇒ ϕ ( j − x vu , then ϕ ( j ) ∧ ϕ ( j ) is satisfiableand there is no x uv in ϕ ( j ) such that x uv ∗ ⇒ ϕ ( j ) x vu . Proof.
By Lemma 12 we have that if ϕ ( j − ∧ ϕ ( j − is satisfiable, then ϕ ( j )3NAE ∧ ϕ ( j )2SAT iswell-defined.Note that if ϕ ( j − = ∅ , this also implies that ϕ ( j )3NAE = ∅ , and then ϕ ( j )3NAE ∧ ϕ ( j )2SAT issatisfiable and there is no x uv in ϕ ( j )2SAT such that x uv ∗ ⇒ ϕ ( j )2SAT x vu by Lemma 15. a x a ′ x b x b ′ x c x c ′ x d x d ′ x Figure 3
Illustration of the variable gadget used in the reduction in the proof of Theorem 18.
From now on we assume that ϕ ( j − ̸ = ∅ . We now argue that whenever ϕ ( j − ̸ = ϕ ( j )3NAE ,we have removed some clauses from ϕ ( j − in Line 12 or in Line 14 of Algorithm 3. ByObservation 13 the removed clauses are satisfied for all satisfying assignments of ϕ ( j )2SAT andby Lemma 15 we know that ϕ ( j )2SAT is satisfiable and there is no x uv in ϕ ( j )2SAT such that x uv ∗ ⇒ ϕ ( j )2SAT x vu . It follows that ϕ ( j )3NAE ∧ ϕ ( j )2SAT is also satisfiable. ◀ Now we have all ingredients to show that we can solve
TTO in polynomial time. ▶ Theorem 17.
Algorithm 4 solves
TTO in polynomial time.
Proof.
If Algorithm 4 outputs an orientation, then clearly ϕ (0)3NAE and ϕ (0)2SAT is satisfiableand by Observation 8 we know that this implies that the input instance is a yes -instance.If the input instance is a yes -instance, then by Observation 8 we have that ϕ (0)3NAE and ϕ (0)2SAT is satisfiable. Furthermore, by construction ϕ (0)2SAT does not contain any x uv such that x uv ∗ ⇒ ϕ (0)2SAT x vu . Lemma 16 now implies that Algorithm 4 finds a satisfying assignment andoutputs an orientation.Lastly, it is easy to check that Algorithm 4 runs in polynomial time. ◀ In this section we show that in contrast to the other variants,
Strict TTO is NP-complete. ▶ Theorem 18.
Strict TTO is NP-complete even if the temporal input graph has onlyfour different time labels.
Proof.
We present a polynomial time reduction from (3,4)-SAT [46] where, given a CNFformula ϕ where each clause contains exactly three literals and each variably appears inexactly four clauses, we are asked whether ϕ is satisfiable or not. Given a formula ϕ , weconstruct a temporal graph G as follows. Variable gadget.
For each variable x that appears in ϕ , we add eight vertices a x , a ′ x , b x , b ′ x , c x , c ′ x , d x , d ′ x to G . We connect these vertices as depicted in Figure 3, thatis, we add the following time edges to G : ( { a x , a ′ x } , { a ′ x , b x } , { b x , b ′ x } , { b ′ x , c x } , { c x , c ′ x } , { c ′ x , d x } , { d x , d ′ x } , { d ′ x , a x } , Clause gadget.
For each clause c of ϕ , we add six vertices u c , u ′ c , v c , v ′ c , w c , w ′ c to G . Weconnect these vertices as depicted in Figure 4, that is, we add the following time edges to G :( { u c , u ′ c } , v c , v ′ c } , { w c , w ′ c } , { u c , v c } , { v c , w c } , { w c , u c } , { v c , w ′ c } , { w c , v ′ c } , Connecting variable gadgets and clause gadgets.
Let variable x appear for the i th time in clause c and let x appear in the j th literal of c . The four vertex pairs ( a x , a ′ x ) , ( b x , b ′ x ) , ( c x , c ′ x ) , ( d x , d ′ x )from the variable gadget of x correspond to the first, second, third, and fourth appearance of x , respectively. The three vertices u ′ c , v ′ c , w ′ c correspond to the first, second, and third literal .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 23 u c v c w c u ′ c v ′ c w ′ c (a)2 23 3 123 3 u c v c w c u ′ c v ′ c w ′ c (b)2 23 3 123 3 u c v c w c u ′ c v ′ c w ′ c (c)2 23 3 123 3 Figure 4
Illustration of the clause gadget used in the reduction in the proof of Theorem 18 andthree ways how to orient the edges in it. of c , respectively. Let i = 1 and j = 1. If x appears non-negated, then we add the time edge( { a x , u ′ c } , x appears negated, we add the time edge ( { a ′ x , u ′ c } , i and j we add time edges analogously.This finishes the reduction. It can clearly be performed in polynomial time. ( ⇒ ): Assume that we have a satisfying assignment for ϕ , then wecan orient G as follows. Then if a variable x is set to true , weorient the edges of the corresponding variable gadgets as follows:( a x , a ′ x ) , ( b x , a ′ x ) , ( b x , b ′ x ) , ( c x , b ′ x ) , ( c x , c ′ x ) , ( d x , c ′ x ) , ( d x , d ′ x ) , ( a x , d ′ x ). Otherwise, if x is set tofalse, we orient as follows: ( a ′ x , a x ) , ( a ′ x , b x ) , ( b ′ x , b x ) , ( b ′ x , c x ) , ( c ′ x , c x ) , ( c ′ x , d x ) , ( d ′ x , d x ) , ( d ′ x , a x ).It is easy so see that both orientations are transitive.Now consider a clause in ϕ with literals u, v, w corresponding to vertices u ′ c , v ′ c , w ′ c of theclause gadget, respectively. We have that at least one of the three literals satisfies the clause.If it is u , then we orient the edges in the clause gadgets as illustrated in Figure 4 (a). It is easyso see that this orientation is transitive. Furthermore, we orient the three edges connectingthe clause gadgets to variable gadgets as follows: By construction the vertices u ′ c , v ′ c , w ′ c areeach connected to a variable gadget. Assume, we have edges { u ′ c , x } , { v ′ c , y } , { w ′ c , z } . Thenwe orient as follows: ( x, u ′ c ) , ( v ′ c , y ) , ( w ′ c , z ), that is, we orient the edge connecting the literalthat satisfies the clause towards the clause gadget and the other two edges towards thevariable gadgets. This yields a transitive in the clause gadget. Note that the variable gadgetshave time labels 1 and 2 so we can always orient the connecting edges (which have timelabel 4) towards the variable gadget. We do this with all connecting edges except ( x, u ′ c ).This edge is oriented from the variable gadget towards the clause gadget, however it alsocorresponds to a literal that satisfies the clause. Then by construction, the edges incident to x in the variable gadget are oriented away from x , hence our orientation is transitive.Otherwise and if v satisfies the clause, then we orient the edges in the clause gadgets asillustrated in Figure 4 (b). Otherwise (in this case w has to satisfy the clause), we orient theedges in the clause gadgets as illustrated in Figure 4 (c). It is easy so see that each of theseorientation is transitive. In both cases we orient the edges connecting the clause gadgets tothe variable gadgets analogously to the first case discussed above. By analogous argumentswe get that the resulting orientation is transitive. ( ⇐ ): Note that all variable gadgets are cycles of length eight with edges havinglabels alternating between 1 and 2 and hence the edges have to also be ori- ented alternately. Consider the variable gadget corresponding to x . We inter-pret the orientation ( a x , a ′ x ) , ( b x , a ′ x ) , ( b x , b ′ x ) , ( c x , b ′ x ) , ( c x , c ′ x ) , ( d x , c ′ x ) , ( d x , d ′ x ) , ( a x , d ′ x )as setting x to true and we interpret the orientation( a ′ x , a x ) , ( a ′ x , b x ) , ( b ′ x , b x ) , ( b ′ x , c x ) , ( c ′ x , c x ) , ( c ′ x , d x ) , ( d ′ x , d x ) , ( d ′ x , a x ) as setting x to true.We claim that this yields a satisfying assignment for ϕ .Assume for contradiction that there is a clause c in ϕ that is not satisfied by thisassignment. Then by construction of the connection of variable gadgets and clause gadgets,the connecting edges have to be oriented towards the variable gadget in order to keep thevariable gadget transitive. Let the three connecting edges be { u ′ c , x } , { v ′ c , y } , { w ′ c , z } and theirorientation ( u ′ c , x ) , ( v ′ c , y ) , ( w ′ c , z ). Then we have that ( u ′ c , x ) forces ( u ′ c , u c ) which in turnforces ( w c , u c ). We have that ( v ′ c , y ) forces ( v ′ c , v c ) which in turn forces ( v c , u c ). Furthermore,we now have that ( w c , u c ) and ( v c , u c ) force ( w c , v c ). Lastly, we have that ( w ′ c , z ) forces( w ′ c , w c ) which in turn forces ( v c , w c ), a contradiction to the fact that we forced ( w c , v c )previously. ◀ We now study the computational complexity of
Temporal Transitive Completion(TTC) . In the static case, the so-called minimum comparability completion problem,i.e. adding the smallest number of edges to a static graph to turn it into a comparabil-ity graph, is known to be NP-hard [25]. Note that minimum comparability completionon static graphs is a special case of
TTC and thus it follows that
TTC is NP-hard too.Our other variants, however, do not generalize static comparability completion in such astraightforward way. Note that for
Strict TTC we have that the corresponding recognitionproblem
Strict TTO is NP-complete (Theorem 18), hence it follows directly that
StrictTTC is NP-hard. For the remaining two variants of our problem, we show in the followingthat they are also NP-hard, giving the result that all four variants of
TTC are NP-hard.Furthermore, we present a polynomial-time algorithm for all four problem variants for thecase that all edges of underlying graph are oriented, see Theorem 20. This allows directly toderive an FPT algorithm for the number of unoriented edges as a parameter. ▶ Theorem 19.
All four variants of
TTC are NP-hard.
Proof.
We give a reduction from the NP-hard
Max-2-Sat problem [23].
Max-2-Sat
Input:
A boolean formula ϕ in implicative normal form and an integer k . Question:
Is there an assignment of the variables which satisfies at least k clauses in ϕ ? We only describe the reduction from
Max-2-Sat to TTC . However, the same constructioncan be used to show NP-hardness of the other variants.Let ( ϕ, k ) be an instance of
Max-2-Sat with m clauses. We construct a temporal graph G as follows. For each variable x of ϕ we add two vertices denoted v x and v x , connected byan edge with label 1. Furthermore, for each 1 ≤ i ≤ m − k + 1 we add two vertices v ix andv ix connected by an edge with label 1. We then connect v ix with v x and v ix with v x usingtwo edges labeled 4. Thus v x , v x , v ix , v ix is a 4-cycle whose edges alternating between 1 and 4.Afterwards, for each clause ( a ⇒ b ) of ϕ with a, b being literals, we add a new vertex w a,b . i.e. a conjunction of clauses of the form ( a ⇒ b ) where a, b are literals. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 25 v x v x y v y
14 41 v z v z x,y
23 w x,z y,z
Figure 5
Temporal graph constructed from the formula ( x ⇒ y ) ∧ ( x ⇒ z ) ∧ ( y ⇒ z ) for k = 1with orientation corresponding to the assignment x = true , y = false , z = true . Since thisassignment does not satisfy the third clause, the dashed blue edge is required to make the graphtemporally transitive. Then we connect w a,b to v a by an edge labeled 2 and to v b by an edge labeled 3. ConsiderFigure 5 for an illustration. Observe that G can be computed in polynomial time.We claim that ( G = ( G, λ ) , ∅ , m − k ) is a yes-instance of TTC if and only if ϕ has a truthassignment satisfying k clauses.For the proof, begin by observing that G does not contain any triangle. Thus an orientationof G is (weakly) (strict) transitive if and only if it does not have any oriented temporal 2-path,i.e. a temporal path of two edges with both edges being directed forward. We call a vertex v of G happy about some orientation if v is not the center vertex of an oriented temporal2-path. Thus an orientation of G is transitive if and only if all vertices are happy. ( ⇐ ): Let α be a truth assignment to the variables (and thus literals) of ϕ satisfying k clausesof ϕ . For each literal a with α ( a ) = true , orient all edges such that they point away fromv a and v ia , 1 ≤ i ≤ m − k + 1. For each literal a with α ( a ) = false , orient all edges suchthat they point towards v a and v ia , 1 ≤ i ≤ m − k + 1. Note that this makes all vertices v a and v ia happy. Now observe that a vertex w a,b is happy unless its edge with v a is orientedtowards w a,b and its edge with v b is oriented towards v b . In other words, w a,b is happy ifand only if α satisfies the clause ( a ⇒ b ). Thus there are at most m − k unhappy vertices.For each unhappy vertex w a,b , we add a new oriented edge from v a to v b with label 5. Notethat this does not make v a or v b unhappy as all adjacent edges are directed away from v a and towards v b . The resulting temporal graph is transitively oriented. ( ⇒ ): Now let a transitive orientation F ′ of G ′ = ( G ′ , λ ′ ) be given, where G ′ is obtained from G by adding at most m − k time edges. Clearly we may also interpret F ′ as an orientationinduced of G . Set α ( x ) = true if and only if the edge between v x and v x is oriented towardsv x . We claim that this assignment α satisfies at least k clauses of ϕ .First observe that for each variable x and 1 ≤ i ≤ m − k + 1, F ′ is a transitive orientationof the 4-cycle v x , v x , v ix , v ix if and only if the edges are oriented alternatingly. Thus, foreach variable, at least one of these k + 1 4-cycles is oriented alternatingly. In particular, for a b c d T b,d = 3 T a,d = 3 Figure 6
Example of a tail-heavy path. every literal a with α ( a ) = true , there is an edge with label 4 that is oriented away from v a .Conversely, if α ( b ) = false , then there is an edge with label 1 oriented towards v b (this issimply the edge from v b ).This implies that every edge with label 2 or 3 oriented from some vertex w c,d (whereeither a = c or a = d ) towards v a with α ( a ) = true requires E ( G ′ ) \ E ( G ) to contain anedge from w c,d to some v ia . Analogously every edge with label 2 or 3 oriented from v a with α ( a ) = false to some w c,d requires E ( G ′ ) \ E ( G ) to contain an edge from v a to w c,d .Now consider the alternative orientation F ′′ obtained from α as detailed in the converseorientation of the proof. For each edge between v a and w c,d where F ′ and F ′′ disagree, F ′′ might potentially require E ( G ′ ) \ E ( G ) to contain the edge v c v d (labeled 5, say), but in turnsaves the need for some edge w c,d v ia or v a w c,d , respectively. Thus, overall, F ′′ requires atmost as many edge additions as F ′ , which are at most m − k . As we have already seen inthe converse direction, F ′′ requires exactly one edge to be added for every clause of ϕ whichis not satisfied. Thus, α satisfies at least k clauses of ϕ . ◀ We now show that
TTC can be solved in polynomial time, if all edges are already oriented,as the next theorem states. While we only discuss the algorithm for
TTC the algorithmonly needs marginal changes to work for all other variants. ▶ Theorem 20.
An instance ( G , F, k ) of TTC where G = ( G, λ ) and G = ( V, E ) , can besolved in O ( m ) time if F is an orientation of E , where m = | E | . The actual proof of Theorem 20 is deferred to the end of this section. The key idea for theproof is based on the following definition. Assume a temporal graph G and an orientation F of G to be given. Let G ′ = ( V, F ) be the underlying graph of G with its edges directedaccording to F . We call a (directed) path P in G ′ tail-heavy if the time-label of its last edgeis largest among all edges of P , and we define t ( P ) to be the time-label of that last edge of P .For all u, v ∈ V , denote by T u,v the maximum value t ( P ) over all tail-heavy ( u, v )-paths P oflength at least 2 in G ′ ; if such a path does not exist then T u,v = ⊥ . If the temporal graph G with orientation F can be completed to be transitive, then adding the time edges of the set X ( G , F ) := { ( uv, T u,v ) | T u,v ̸ = ⊥} , which are not already present in G is an optimal way to do so. Consider Figure 6 for anexample. ▶ Lemma 21.
The set X ( G , F ) can be computed in O ( m ) time, where G is a temporal graphwith m time-edges and F an orientation of G . Proof.
For each edge vw , we can take G ′ (defined above), remove w and all arcs whose labelis larger than λ ( v, w ), and do a depth-first-search from v to find all vertices u which canreach v in the resulting graph. Each of these then has T u,w ≥ λ ( v, w ). By doing this forevery edge vw , we obtain T u,w for every vertex pair u, w . The overall running time is clearly O ( m ). ◀ .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 27 Until the end of this section we are only considering the instance ( G , F, k ) of TTC , where G = ( G, λ ), G = ( V, E ), and F is an orientation of G . Hence, we can say a set X of orientedtime-edges is a solution to I if X ′ := {{ u, v } | ( uv, t ) ∈ X } is disjoint from E , satisfies | X | = | X ′ | ≤ k , and F ′ := F ∪ { uv | ( uv, t ) ∈ X } is a transitive orientation of the temporalgraph G + X := (( V, E ∪ X ′ ) , λ ′ ), where λ ′ ( e ) := λ ( e ) if e ∈ E and λ ′ ( u, v ) := t if X contains( uv, t ) or ( vu, t ).The algorithm we use to show Theorem 20 will use X ( G , F ) to construct a solution (ifthere is any) of a given instance ( G , F, k ) of TTC where F is a orientation of E . To provethe correctness of this approach, we make use of the following. ▶ Lemma 22.
Let I = ( G = ( G, λ ) , F, k ) be an instance of TTC , where G = ( V, E ) and F is an orientation of E and X an solution for I . Then, for any ( vu, T v,u ) ∈ X ( G , F ) there isa ( vu, t ) in G + X with t ≥ T v,u . Proof.
Let ( v v ℓ , T v ,v ℓ ) ∈ X ( G , F ), and G ′ = ( V, F ). Hence, there is a tail-heavy ( v , v ℓ )-path P in G ′ of length ℓ ≥
2. If ℓ = 2, then clearly G + X must contain the time edge( v v ℓ , t ) such that t ≥ T v ,v ℓ . Now let ℓ > V ( P ) := { v i | i ∈ { , , . . . , ℓ }} and E ( P ) = { v i − v i | i ∈ [ ℓ ] } . Since there is a tail-heavy ( v ℓ − , v ℓ )-path in G ′ of length 2, G + X must contain a time-edge ( v ℓ − v ℓ , t ) with t ≥ T v ,v ℓ . Therefore, the (directed) underlyinggraph of G + X contains a tail-heavy ( v , v ℓ )-path of length ℓ −
1. By induction, G + X mustcontain the time edge ( v v ℓ , t ′ ) such that t ′ ≥ t ≥ T v ,v ℓ . ◀ Form Lemma 22, it follows that we can use X ( G , F ) to identify no -instances in some cases. ▶ Corollary 23.
Let I = ( G = ( G, λ ) , F, k ) be an instance of TTC , where G = ( V, E ) and F is an orientation of E . Then, I is a no -instance, if for some v, u ∈ V there are time-edges ( vu, t ) ∈ X ( G , F ) and ( uv, t ′ ) ∈ X ( G , F ) , there is an edge uv ∈ F such that ( vu, T v,u ) ∈ X ( G , F ) , or there is an edge vu ∈ F such that ( vu, T v,u ) ∈ X ( G , F ) with λ ( v, u ) < T v,u . We are now ready to prove Theorem 20.
Proof of Theorem 20.
Let I = ( G = ( G, λ ) , F, k ) be an instance of TTC , where F isa orientation of E . First we compute X ( G , F ) in polynomial time, see Lemma 21. Let Y = { ( vu, t ) ∈ X ( G , F ) | { v, u } ̸∈ E } and report that I is a no -instance if | Y | > k or one ofthe conditions of Corollary 23 holds true. Otherwise report that I is a yes -instance. Thisgives an overall running time of O ( m ).Clearly, if one of the conditions of Corollary 23 holds true, then I is a no -instance.Moreover, by Lemma 22 any solution contains at least | Y | time edges. Thus, if | Y | > k , then I is a no -instance.If we report that I is a yes -instance, then we claim that Y is a solution for I . Let F ′ ⊇ F be a orientation of G + Y . Assume towards a contradiction that F ′ is not transitive. Then,there is a temporal path (( vu, t ) , ( uw, t )) in G + Y such that there is no time-edge ( uw, t )in G + Y , with t ≥ t . By definition of X ( G , F ), the directed graph G ′ = ( V, F ) contains atail-heavy ( v, u )-path P with t = t ( P ) and a tail-heavy ( u, w )-path P with t = t ( P ) ≥ t .By concatenation of P and P , we obtain that the G ′ contains a ( v, w )-path P ′ of length atleast two such that t = t ( P ′ ). Thus, t ≤ T v,w and ( vw, T v,w ) ∈ X ( G )—a contradiction. ◀ Using Theorem 20 we can now prove that
TTC is fixed-parameter tractable (FPT) withrespect to the number of unoriented edges in the input temporal graph G . x x x Figure 7
Temporal graph constructed from the formula
NAE ( x , x , x ) ∧ NAE ( x , x , x ) andorientation corresponding to setting x = false , x = true , and x = false . Each attachmentvertex is at the clockwise end of its edge. ▶ Corollary 24.
Let I = ( G = ( G, λ ) , F, k ) be an instance of TTC , where G = ( V, E ) . Then I can be solved in O (2 q · m ) , where q = | E | − | F | and m the number of time edges. Proof.
Note that there are 2 q ways to orient the q unoriented edges. For each of these 2 q orientations of these q edges, we obtain a fully oriented temporal graph. Then we can solve TTC on each of these fully oriented graphs in O ( m ) time by Theorem 20. Summarizing,we can solve TTC on I in 2 q · m rime. ◀ In this section we prove that
Multilayer Transitive Orientation (MTO) is NP-complete, even if every edge of the given temporal graph has at most two labels. Recall thatthis problem asks for an orientation F of a temporal graph G = ( G, λ ) (i.e. with exactly oneorientation for each edge of G ) such that, for every “time-layer” t ≥
1, the (static) orientedgraph defined by the edges having time-label t is transitively oriented in F . As we discussedin Section 2, this problem makes more sense when every edge of G potentially has multipletime-labels, therefore we assume here that the time-labeling function is λ : E → N . ▶ Theorem 25.
MTO is NP-complete, even on temporal graphs with at most two labels peredge.
Proof.
We give a reduction from monotone
Not-All-Equal-3Sat , which is known to beNP-hard [42]. So let ϕ = V mi =1 NAE ( y i, , y i, , y i, ) be a monotone Not-All-Equal-3Sat instance and X := { x , . . . , x n } := S mi =1 { y i, , y i, , y i, } be the set of variables.Start with an empty temporal graph G . For every clause NAE ( y i, , y i, , y i, ), add to G atriangle on three new vertices and label its edges a i, , a i, , a i, . Give all these edges label n + 1.For each of these edges, select one of its endpoints to be its attachment vertex in such a waythat no two edges share an attachment vertex. Next, for each 1 ≤ i ≤ n , add a new vertex v i .Let A i := { a i,j | y i,j = x i } . Add the label i to every edge in A i and connect its attachmentvertex to v i with an edge labeled i . See also Figure 7.We claim that G is a yes -instance of MTO if and only if ϕ is satisfiable. ( ⇐ ): Let α : X → { true , false } be an assignment satisfying ω . For every x i ∈ X , orientall edges adjacent to v i away from v i if α ( x i ) = true and towards v i otherwise. Then, orientevery edge a i,j towards its attachment vertex if α ( y i,j ) = true and away from it otherwise. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 29 Note that in the layers 1 through n every vertex either has all adjacent edges orientedtowards it or away from it. Thus these layers are clearly transitive. It remains to considerlayer n + 1 which consists of a disjoint union of triangles. Each such triangle a i, , a i, , a i, is oriented non-transitively (i.e. cyclically) if and only if α ( y i, ) = α ( y i, ) = α ( y i, ), whichnever happens if α satisfies ϕ . ( ⇒ ): Let ω be an orientation of the underlying edges of G such that every layer is transitive.Since they all share the same label i , the edges adjacent to v i must be all oriented towardsor all oriented away from v i . We set α ( x i ) = false in the former and α ( x i ) = true in thelatter case. This in turn forces each edge a i,j to be oriented towards its attachment vertex ifand only if α (a i,j ) = true . Therefore, every clause NAE ( y i, , y i, , y i, ) is satisfied, since thethree edges a i, , a i, , a i, form a triangle in layer n + 1 and can thus not be oriented cyclically(i.e. all towards or all away from their respective attachment vertices). ◀ References Eleni C. Akrida, Leszek Gasieniec, George B. Mertzios, and Paul G. Spirakis. Ephemeralnetworks with random availability of links: The case of fast networks.
Journal of Parallel andDistributed Computing , 87:109–120, 2016. Eleni C. Akrida, Leszek Gasieniec, George B. Mertzios, and Paul G. Spirakis. The complexity ofoptimal design of temporally connected graphs.
Theory of Computing Systems , 61(3):907–944,2017. Eleni C. Akrida, George B. Mertzios, Sotiris E. Nikoletseas, Christoforos L. Raptopoulos,Paul G. Spirakis, and Viktor Zamaraev. How fast can we reach a target vertex in stochastictemporal graphs?
Journal of Computer and System Sciences , 114:65–83, 2020. An extendedabstract appeared at ICALP 2019. Eleni C. Akrida, George B. Mertzios, Paul G. Spirakis, and Viktor Zamaraev. Temporal vertexcover with a sliding time window.
Journal of Computer and System Sciences , 107:108–123,2020. An extended abstract appeared at ICALP 2018. Josh Alman and Virginia Vassilevska Williams. A refined laser method and faster matrixmultiplication. In
Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms(SODA) , pages 522–539, 2021. Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear-time algorithm for testingthe truth of certain quantified boolean formulas.
Information Processing Letters , 8(3):121–123,1979. Kyriakos Axiotis and Dimitris Fotakis. On the size and the approximability of minimumtemporally connected subgraphs. In
Proceedings of the 43rd International Colloquium onAutomata, Languages, and Programming, (ICALP) , pages 149:1–149:14, 2016. Matthias Bentert, Anne-Sophie Himmel, Hendrik Molter, Marco Morik, Rolf Niedermeier,and René Saitenmacher. Listing all maximal k -plexes in temporal graphs. ACM Journal ofExperimental Algorithmics , 24(1):13:1–13:27, 2019. Matthias Bentert, Anne-Sophie Himmel, André Nichterlein, and Rolf Niedermeier. Efficientcomputation of optimal temporal walks under waiting-time constraints.
Applied NetworkScience , 5(1):73, 2020. Robert Bredereck, Christian Komusiewicz, Stefan Kratsch, Hendrik Molter, Rolf Niedermeier,and Manuel Sorge. Assessing the computational complexity of multilayer subgraph detection.
Network Science , 7(2):215–241, 2019. Binh-Minh Bui-Xuan, Afonso Ferreira, and Aubin Jarry. Computing shortest, fastest, andforemost journeys in dynamic networks.
International Journal of Foundations of ComputerScience , 14(02):267–285, 2003. Sebastian Buß, Hendrik Molter, Rolf Niedermeier, and Maciej Rymar. Algorithmic aspects oftemporal betweenness. In
Proceedings of the 26th ACM SIGKDD Conference on KnowledgeDiscovery and Data Mining (KDD) , pages 2084–2092. ACM, 2020. Arnaud Casteigts and Paola Flocchini. Deterministic Algorithms in Dynamic Networks:Formal Models and Metrics. Technical report, Defence R&D Canada, April 2013. URL: https://hal.archives-ouvertes.fr/hal-00865762 . Arnaud Casteigts and Paola Flocchini. Deterministic Algorithms in Dynamic Networks:Problems, Analysis, and Algorithmic Tools. Technical report, Defence R&D Canada, April2013. URL: https://hal.archives-ouvertes.fr/hal-00865764 . Arnaud Casteigts, Paola Flocchini, Walter Quattrociocchi, and Nicola Santoro. Time-varyinggraphs and dynamic networks.
International Journal of Parallel, Emergent and DistributedSystems , 27(5):387–408, 2012. Arnaud Casteigts, Anne-Sophie Himmel, Hendrik Molter, and Philipp Zschoche. Findingtemporal paths under waiting time constraints. In , pages 30:1–30:18, 2020. Arnaud Casteigts, Joseph G. Peters, and Jason Schoeters. Temporal cliques admit sparsespanners. In
Proceedings of the 46th International Colloquium on Automata, Languages, andProgramming (ICALP) , volume 132, pages 134:1–134:14, 2019. Jiehua Chen, Hendrik Molter, Manuel Sorge, and Ondřej Suchý. Cluster editing in multi-layerand temporal graphs. In
Proceedings of the 29th International Symposium on Algorithms andComputation (ISAAC) , pages 24:1–24:13, 2018. J. Enright, K. Meeks, G.B. Mertzios, and V. Zamaraev. Deleting edges to restrict the size ofan epidemic in temporal networks.
Journal of Computer and System Sciences . To appear. Jessica Enright, Kitty Meeks, and Fiona Skerman. Assigning times to minimise reachability intemporal graphs.
Journal of Computer and System Sciences , 115:169–186, 2021. Thomas Erlebach, Michael Hoffmann, and Frank Kammer. On temporal graph exploration. In
Proceedings of the 42nd International Colloquium on Automata, Languages, and Programming(ICALP) , pages 444–455, 2015. Till Fluschnik, Hendrik Molter, Rolf Niedermeier, Malte Renken, and Philipp Zschoche.Temporal graph classes: A view through temporal separators.
Theoretical Computer Science ,806:197–218, 2020. M.R. Garey, D.S. Johnson, and L. Stockmeyer. Some simplified NP-complete graph problems.
Theoretical Computer Science , 1(3):237–267, 1976. Martin Charles Golumbic.
Algorithmic graph theory and perfect graphs . Elsevier, 2nd edition,2004. S Louis Hakimi, Edward F Schmeichel, and Neal E Young. Orienting graphs to optimizereachability.
Information Processing Letters , 63(5):229–235, 1997. Anne-Sophie Himmel, Hendrik Molter, Rolf Niedermeier, and Manuel Sorge. Adapting theBron-Kerbosch algorithm for enumerating maximal cliques in temporal graphs.
Social NetworkAnalysis and Mining , 7(1):35:1–35:16, 2017. Petter Holme and Jari Saramäki.
Temporal network theory , volume 2. Springer, 2019. David Kempe, Jon M. Kleinberg, and Amit Kumar. Connectivity and inference problems fortemporal networks.
Journal of Computer and System Sciences , 64(4):820–842, 2002. Hyoungshick Kim and Ross Anderson. Temporal node centrality in complex networks.
PhysicalReview E , 85(2):026107, 2012. Ross M. McConnell and Jeremy P. Spinrad. Linear-time modular decomposition and efficienttransitive orientation of comparability graphs. In
Proceedings of the 5th Annual ACM-SIAMSymposium on Discrete Algorithms (SODA) , pages 536–545, 1994. Ross M. McConnell and Jeremy P. Spinrad. Linear-time transitive orientation. In
Proceedingsof the 8th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA) , pages 19–25, 1997. Ross M. McConnell and Jeremy P. Spinrad. Modular decomposition and transitive orientation.
Discrete Mathematics , 201(1-3):189–241, 1999. .B. Mertzios, H. Molter, M. Renken, P.G. Spirakis and P. Zschoche 31 David B McDonald and Daizaburo Shizuka. Comparative transitive and temporal orderlinessin dominance networks.
Behavioral Ecology , 24(2):511–520, 2013. George B. Mertzios. The recognition of simple-triangle graphs and of linear-interval orders ispolynomial.
SIAM Journal on Discrete Mathematics , 29(3):1150–1185, 2015. George B. Mertzios, Othon Michail, Ioannis Chatzigiannakis, and Paul G. Spirakis. Temporalnetwork optimization subject to connectivity constraints. In
Proceedings of the 40th Inter-national Colloquium on Automata, Languages, and Programming (ICALP) , pages 657–668,2013. George B Mertzios, Hendrik Molter, Rolf Niedermeier, Viktor Zamaraev, and Philipp Zschoche.Computing maximum matchings in temporal graphs. In
Proceedings of the 37th InternationalSymposium on Theoretical Aspects of Computer Science (STACS) , volume 154, pages 27:1–27:14, 2020. George B Mertzios, Hendrik Molter, and Viktor Zamaraev. Sliding window temporal graphcoloring. In
Proceedings of the 31st AAAI Conference on Artificial Intelligence (AAAI) ,volume 33, pages 7667–7674, 2019. Othon Michail and Paul G. Spirakis. Elements of the theory of dynamic networks.
Commu-nications of the ACM , 61(2):72–72, January 2018. Robert Moskovitch and Yuval Shahar. Medical temporal-knowledge discovery via temporalabstraction. In
Proceedings of the AMIA Annual Symposium , page 452, 2009. Robert Moskovitch and Yuval Shahar. Fast time intervals mining using the transitivity oftemporal relations.
Knowledge and Information Systems , 42(1):21–48, 2015. V. Nicosia, J. Tang, C. Mascolo, M. Musolesi, G. Russo, and V. Latora. Graph metrics fortemporal networks. In
Temporal Networks . Springer, 2013. Thomas J. Schaefer. The complexity of satisfiability problems. In
Proceedings of the 10thAnnual ACM Symposium on Theory of Computing (STOC) , pages 216–226, 1978. Jeremy P. Spinrad. On comparability and permutation graphs.
SIAM Journal on Computing ,14(3):658–670, 1985. Jeremy P. Spinrad.
Efficient graph representations , volume 19 of
Fields Institute Monographs .American Mathematical Society, 2003. Xavier Tannier and Philippe Muller. Evaluating temporal graphs built from texts via transitivereduction.
Journal of Artificial Intelligence Research (JAIR) , 40:375–413, 2011. Craig A Tovey. A simplified NP-complete satisfiability problem.
Discrete Applied Mathematics ,8(1):85–89, 1984. Tiphaine Viard, Matthieu Latapy, and Clémence Magnien. Computing maximal cliques inlink streams.
Theoretical Computer Science , 609:245–252, 2016. Huanhuan Wu, James Cheng, Yiping Ke, Silu Huang, Yuzhen Huang, and Hejun Wu. Efficientalgorithms for temporal path computation.
IEEE Transactions on Knowledge and DataEngineering , 28(11):2927–2942, 2016. Philipp Zschoche, Till Fluschnik, Hendrik Molter, and Rolf Niedermeier. The complexity offinding separators in temporal graphs.