#P-completeness of counting update digraphs, cacti, and a series-parallel decomposition method
cacti, and a series-parallel decomposition method
Camille Noûs , Kévin Perrot , Sylvain Sené , and Lucas Venturini Université publique, France
Abstract
Automata networks are a very general model of interacting entities, with applica-tions to biological phenomena such as gene regulation. In many contexts, the order inwhich entities update their state is unknown, and the dynamics may be very sensitive tochanges in this schedule of updates. Since the works of Aracena et. al, it is known thatupdate digraphs are pertinent objects to study non-equivalent block-sequential updateschedules. We prove that counting the number of equivalence classes, that is a tightupper bound on the synchronism sensitivity of a given network, is P -complete. Theproblem is nevertheless computable in quasi-quadratic time for oriented cacti, and fororiented series-parallel graphs thanks to a decomposition method. Since their introduction by McCulloch and Pitts in the 1940s through the well known formalneural networks [28], automata networks (ANs) are a general model of interacting entities infinite state spaces. The field has important contributions to computer science, with Kleene’sfinite state automata [25], linear shift registers [22] and linear networks [16]. At the end of the1960s, Kauffman and Thomas (independently) developed the use of ANs for the modelingof biological phenomena such as gene regulation [24, 38], providing a fruitful theoreticalframework [34].ANs can be considered as a collection of local functions (one per component), and in-fluences among components may be represented as a so called interaction digraph . In manyapplications the order of components update is a priori unknown, and different schedulesmay greatly impact the dynamical properties of the system. It is known since the works ofAracena et al. in [5] that update digraphs (consisting of labeling the arcs of the interactiondigraphs with ⊕ and (cid:9) ) capture the correct notion to consider a biologically meaningfulfamily of update schedules called block-sequential in the literature. Since another work ofAracena et al. [4] a precise characterization of the valid labelings is known, but their combi-natorics remained puzzling. After formal definitions and known results in Sections 2 and 3,we propose in Section 4 an explanation for this difficulty, through the lens of computational1 a r X i v : . [ c s . D M ] A p r
23 4 ⊕ (cid:9)⊕ ⊕ f ( x ) = f ( x ) = ¬ x f ( x ) = x ∨ ¬ x f ( x ) = x Figure 1: Example of an AN f on the Boolean alphabet [ q ] = { , } (conventionally renamed { , } ), its interaction digraph, and a {⊕ , (cid:9)} -labeling lab B = lab B (cid:48) corresponding to the twoequivalent update schedules B = ( { , , } , { } ) and B (cid:48) = ( { , } , { , } ) .complexity theory: we prove that counting the number of update digraphs (valid {⊕ , (cid:9)} -labelings) is P -complete. In Section 5 we consider the problem restricted to the familyof oriented cactus graphs and give a O ( n log n log log n ) time algorithm, and finally in Sec-tion 6 we present a decomposition method leading to a O ( n log n log log n ) algorithm fororiented series-parallel graphs. Given a finite alphabet [ q ] = { , . . . , q } , an automata network (AN) of size n is a function f : [ q ] n → [ q ] n . We denote x i the component i ∈ [ n ] of some configuration x ∈ [ q ] n . ANsare more conveniently seen as n local functions f i : [ q ] n → [ q ] describing the update ofeach component, i.e. with f i ( x ) = f ( x ) i . The interaction digraph captures the effectivedependencies among components, and is defined as the digraph G f = ([ n ] , A f ) with ( i, j ) ∈ A f ⇐⇒ f j ( x ) (cid:54) = f j ( y ) for some x, y ∈ [ q ] n with x i (cid:48) = y i (cid:48) for all i (cid:48) (cid:54) = i. It is well known that the schedule of components update may have a great impact on thedynamics [6, 10, 17, 19, 29, 31]. A block-sequential update schedule B = ( B , . . . , B t ) is anordered partition of [ n ] , defining the following dynamics f ( B ) = f ( B t ) ◦ · · · ◦ f ( B ) ◦ f ( B ) with f ( B i ) ( x ) j = (cid:40) f j ( x ) if j ∈ B i x j if j / ∈ B i i.e. , parts are updated sequentially one after the other, and components within a part areupdated in parallel. For the parallel update schedule B par = ([ n ]) , we have f ( B par ) = f .Block-sequential update schedules are a classical family of update schedules considered inthe literature, because they are perfectly fair: every local function is applied exactly onceduring each step. Equipped with an update schedule, f ( B ) is a discrete dynamical systemon [ q ] n . In the following we will shortly say update schedule to mean block-sequential updateschedule .It turns out quite intuitively that some update schedules will lead to the same dynamics,when the ordered partitions are very close and the difference relies on components far apartin the interaction digraph (see an example on Figure 1). Aracena et al. introduced in [5]the notion of update digraph to capture this fact. To an update schedule one can associateits update digraph , which is a {⊕ , (cid:9)} -labeling of the arcs of the interaction digraph of the2N, such that ( i, j ) is negative ( (cid:9) ) when i is updated strictly before j , and positive ( ⊕ )otherwise. Formally, given an update schedule B = ( B , . . . , B t ) , ∀ ( i, j ) ∈ A f : lab B (( i, j )) = (cid:40) ⊕ if i ∈ B t i and j ∈ B t j with t i ≥ t j , (cid:9) if i ∈ B t i and j ∈ B t j with t i < t j . Remark 1.
Loops are always labeled ⊕ , hence we consider all interaction digraphs loopless . The following result has been established: given two update schedules, if the relative orderof updates among all adjacent components are identical, then the dynamics are identical.
Theorem 2 ([5]) . Given an AN f and two update schedules B, B (cid:48) , if lab B = lab B (cid:48) then f ( B ) = f ( B (cid:48) ) . This leads naturally to an equivalence relation on update schedules, at the heart of thepresent work.
Definition 3. B ≡ B (cid:48) if and only if lab B = lab B (cid:48) . It is very important to note that, though every update schedule corresponds to a {⊕ , (cid:9)} -labeling of G f , the reciprocal of this fact is not true. For example, a cycle with all arcslabeled (cid:9) would lead to a contradiction where components are updated strictly before them-selves. Aracena et al. gave a precise characterization of valid update digraphs ( i.e. the onescorresponding to at least one update schedule). Theorem 4 ([4]) . A labeling function lab : A → {⊕ , (cid:9)} is valid if and only if there is nocycle ( i , i , . . . , i k ) , with i = i k , of length k > such that both: • ∀ ≤ j < k : (( i j , i j +1 ) ∈ A ∧ lab(( i j , i j +1 )) = ⊕ ) ∨ (( i j +1 , i j ) ∈ A ∧ lab(( i j +1 , i j )) = (cid:9) ) , • ∃ ≤ j < k : lab(( i j +1 , i j )) = (cid:9) .In words, the multidigraph where the labeling is unchanged but the orientation of negativearcs is reversed, does not contain a cycle with at least one negative arc (forbidden cycle) . As a corollary, one can decide in polynomial time whether a labeling is valid.
Valid Update Digraph Problem (Valid-UD Problem)
Input: a labeling lab : A → {⊕ , (cid:9)} of a digraph G = ( V, A ) . Question: is lab valid? Corollary 5 ([4]) . Valid-UD Problem is in P . We are interested in the following counting problem.
Update Digraphs Counting (
Input: a digraph G = ( V, A ) . Output: UD ( G ) = |{ lab : A → {(cid:9) , ⊕} | lab is valid }| .The following definition is motivated by Theorem 4. Definition 6.
Given a directed graph G = ( V, A ) , let ¯ G = ( V, ¯ A ) denote the undirectedmultigraph underlying G , i.e. with an edge { i, j } ∈ ¯ A for each ( i, j ) ∈ A . emark 7. We can restrict our study to connected digraphs (that is, such that ¯ G is con-nected), because according to Theorem 4 the only invalid labelings contain (forbidden) cycles.Given some G with V , . . . , V k its connected components, and G [ V i ] the subdigraph inducedby V i , we straightforwardly have UD ( G ) = (cid:89) i ∈ [ k ] UD ( G [ V i ]) , and this decomposition can be computed in linear time from folklore algorithms. Theorem 8. is in P .Proof. The following non-deterministic algorithm runs in polynomial time (step 2 from Corol-lary 5), and its number of accepting branches equals UD ( G ) :1. guess a labeling lab : A → {⊕ , (cid:9)} (polynomial space),2. accept if lab is valid, otherwise reject. The consideration of update digraphs has been initiated by Aracena et al. in 2009 [5], withtheir characterization (Theorem 4) in [4]. In Section 4 we will present a problem closelyrelated to that has been proven to be NP -complete in [4], UD Problem , and boundsthat we can deduce on (Corollary 10, from [3]). In [2] the authors present an algorithmto enumerate update digraphs, and prove its correctness. They also consider a surprisinglycomplex question: given an AN f , knowing whether there exist two block-sequential updateschedules B, B (cid:48) such that f ( B ) (cid:54) = f ( B (cid:48) ) , is NP -complete. The value of UD ( G ) is known tobe n − n +1 + 2 for bidirected cycles on n vertices [31], and to equal n ! if and only if thedigraph is a tournament on n vertices [3]. P -complete The authors of [4] have exhibited an insightful relation between valid labelings and feedbackarc sets of a digraph. We recall that a feedback arc set (FAS) of G = ( V, A ) is a subset ofarcs F ⊆ A such that the digraph ( V, A \ F ) is acyclic, and its size is | F | . This relationis developed inside the proof of NP -completeness of the following decision problem. Wereproduce it as a Lemma, with its argumentation for the sake of comprehension. Update Digraph Problem (UD Problem)
Input: a digraph G = ( V, A ) and an integer k . Question: does there exist a valid labeling of size at most k ?The size of a labeling is its number of ⊕ labels. It is clear that minimizing the number of ⊕ labels (or equivalently maximizing the number of (cid:9) labels) is the difficult direction, thecontrary being easy because lab( a ) = ⊕ for all a ∈ A is always valid (and corresponds to theparallel update schedule B par ). 4 ⊕⊕(cid:9)⊕ Figure 2: F = { (1 , , (2 , , (3 , } is a FAS, but the corresponding labeling is not valid:component is updated prior to , not prior to , and not prior to , which is impossible. Lemma 9 (appears in [4, Theorem 16]) . There exists a bijection between minimal validlabelings and minimal feedback arc sets of a digraph G = ( V, A ) .Proof. To get the bijection, we simply identify a labeling lab with its set of arcs labeled ⊕ ,denoted F lab = { a ∈ A | lab( a ) = ⊕} .Given any valid labeling lab , F lab is a FAS, otherwise there is a cycle with all its arcslabel (cid:9) , which is forbidden.Given a minimal FAS F , let us now argue that lab such that F lab = F is a valid labeling.First observe that for every a ∈ F there is a cycle in G containing a and no other arc of F ,otherwise F would not be minimal (removing an arc a not fulfilling this observation wouldgive a smaller FAS). By contradiction, if lab creates a forbidden cycle C , then to every arc a labeled ⊕ in C we can associate, from the previous observation, a cycle C a containing noother arc labeled ⊕ and distinct from C . It follows that replacing all such arcs a in C with C a \ { a } gives a cycle which now contains only arcs labeled (cid:9) , i.e. a cycle (recall that theorientation of (cid:9) arcs is reversed in forbidden cycles) with no arc in F , a contradiction.Any valid labeling corresponds to a FAS, and every minimal FAS corresponds to a validlabeling, hence the following bounds hold. The strict inequality for the lower bound comesfrom the fact that labeling all arcs ⊕ does not give a minimal FAS, as noted in [3] where theauthors also consider the relation between update digraphs (valid labelings) and feedbackarc sets, but from another perspective. Corollary 10 ([4]) . For any digraph G , let FAS ( G ) and MFAS ( G ) be respectively thenumber of FAS and minimal FAS of G , then MFAS ( G ) < UD ( G ) ≤ FAS ( G ) . From Lemma 9 and results on the complexity of FAS counting problems presented in [30](one of them coming from [37]), we have the following corollary (minimum FAS are minimal,hence the identity is a parsimonious reduction from the same problems on FAS).
Corollary 11.
Counting the number of valid labelings of minimal size is P -complete, andcounting the number of valid labelings of minimum size is · OptP [log n ] -complete. However the correspondence given in Lemma 9 does not hold in general: there may existsome FAS F such that lab with F lab = F is not a valid labeling (see Figure 2 for an example).As a consequence we do not directly get a counting reduction to . It nevertheless holdsthat is P -hard, with the following reduction. Theorem 12. is P -hard. G Figure 3: An undirected graph G (instance of acyclic orientation counting), and the obtaineddigraph G (cid:48) (instance of update digraph counting). A (cid:9)(cid:9) (cid:9)(cid:9)(cid:9) ⊕⊕ O Figure 4: A valid labeling A of G (cid:48) , and the corresponding orientation O of G . Proof.
We present a (polynomial time) parsimonious reduction from the problem of countingthe number of acyclic orientations of an undirected graph, proven to be P -hard in [26].Given an undirected graph G = ( V, E ) , let ≺ denote an arbitrary total order on V .Construct the digraph G (cid:48) = ( V, A ) with A the orientation of E according to ≺ , ( u, v ) ∈ A ⇐⇒ { u, v } ∈ E and u ≺ v. An example is given on Figure 3. A key property is that G (cid:48) is acyclic, because A is constructedfrom an order ≺ on V (a cycle would have at least one arc ( u, v ) with v ≺ u ).We claim that there is a bijection between the valid labelings of G (cid:48) and the acyclicorientations of G : to a valid labeling lab : A → {⊕ , (cid:9)} of G (cid:48) we associate the orientation O = { ( u, v ) | ( u, v ) ∈ A and lab(( u, v )) = ⊕}∪ { ( v, u ) | ( u, v ) ∈ A and lab(( u, v )) = (cid:9)} . First remark that O is indeed an orientation of E : each edge of E is transformed into anarc of A , and each arc of A is transformed into an arc of O . An example is given on Figure 4.Now observe that O is exactly obtained from G (cid:48) by reversing the orientation of arcs labeled (cid:9) by lab . Furthermore, a cycle in O must contain at least one arc labeled (cid:9) by lab , because G (cid:48) is acyclic and ⊕ labels copy the orientation of G (cid:48) . The claim therefore follows directlyfrom the characterization of Theorem 4. The difficulty of counting the number of update digraphs comes from the interplay betweenvarious possible cycles, as is assessed by the parsimonious reduction from acyclic orientationscounting problem to UD . Answering the problem for an oriented tree with m arcs is forexample very simple: all of the m labelings are valid. Cactus undirected graphs are definedin terms of very restricted entanglement of cycles, which we can exploit to compute thenumber of update digraphs for any orientation of its edges.6 h gcc gh cchgc cc Figure 5: An oriented cactus G , with { c,g,h } -vertex labels. Graft arcs are dashed, cy-cles forming directed cycles are dotted, and cycles not forming directed cycles are solid.Theorem 14 counts UD ( G ) = 2 (2 − − −
2) = 48 608 . Definition 13. A cactus is a connected undirected graph such that any vertex (or equivalentlyany edge) belongs to at most one simple cycle (cycle without vertex repetition). An orientedcactus G is a digraph such that ¯ G is a cactus. Cacti may intuitively be thought as trees with cycles. This is indeed the idea behind the skeleton of a cactus introduced in [12], via the following notions: • a c-vertex is a vertex of degree two included in exactly one cycle, • a g-vertex is a vertex not included in any cycle, • remaining vertices are h-vertices ,and a graft is a maximal subtree of g- and h-vertices with no two h-vertices belonging tothe same cycle. Then a cactus can be decomposed as grafts and cycles (two classes called blocks ), connected at h-vertices according to a tree skeleton. These notions directly apply tooriented cacti (see an example on Figure 5). Theorem 14. is computable in time O ( n log n log log n ) for oriented cacti.Proof. The result is obtained from the skeleton of an oriented cactus G , since potentialforbidden cycles are limited to within blocks of the skeleton. From this independence, anyunion of valid labelings on blocks is valid, and we have the product UD ( G ) = (cid:89) H ∈G | H | (cid:89) H ∈ (cid:126) C (2 | H | − (cid:89) H ∈C (2 | H | − where G is the set of grafts of G , (cid:126) C is the set of cycles forming directed cycles, C is the setof cycles not forming directed cycles, and | H | is the number of arcs in block H . Indeed,grafts cannot create forbidden cycles hence any {⊕ , (cid:9)} -labeling will be valid, cycles forminga directed cycle can create exactly one forbidden cycle (with (cid:9) labels on all arcs), and cyclesnot forming a directed cycle can create exactly two forbidden cycles (one for each possibledirection of the cycle). In a first step the skeleton of a cactus can be computed in lineartime [12]. Then, since the size n of the input is equal (up to a constant) to the number ofarcs, the size of the output contains O ( n ) bits (upper bounded by the number of {⊕ , (cid:9)} -labelings), thus naively we have O ( n ) terms, each of O ( n ) bits, and the O ( n log n log log n ) Schönhage–Strassen integer multiplication algorithm [36] gives the result.
Remark 15.
Assuming multiplications to be done in constant time in the above result wouldbe misleading, because we are multiplying integers having a number of digits in the mag-nitude of the input size. Also, the result may be slightly strengthened by considering the O ( n log n ∗ n ) algorithm by Fürer in 2007 [18], and maybe more efficient integer multi-plication algorithms in the future, such as the O ( n log n ) algorithm recently claimed [20]. Series-parallel decomposition method
In this section we present a divide and conquer method in order to solve , i.e. in orderto count the number of valid labelings (update digraphs) of a given digraph. What will beessential in this decomposition method is not the orientation of arcs, but rather the topologyof the underlying undirected (multi)graph ¯ G . The (de)composition is based on defining twoendpoints on our digraphs, and composing them at their endpoints. It turns out to be closelyrelated to series-parallel graphs first formalized to model electric networks in 1892 [27]. InSubsection 6.1 we present the operations of composition, and in Subsection 6.2 we show howit applies to the family of oriented series-parallel graphs. Let us first introduce some notations and terminology on the characterization of valid la-belings provided by Theorem 4. Given lab : A → {⊕ , (cid:9)} , we denote ˜ G lab = ( V, ˜ A ) themultidigraph obtained by reversing the orientation of negative arcs: ( i, j ) ∈ ˜ A ⇐⇒ ( i, j ) ∈ A and lab(( i, j )) = ⊕ , or ( j, i ) ∈ A and lab(( j, i )) = (cid:9) . For simplicity we abuse the notation and still denote lab the labeling of the arcs of ˜ G lab (arcskeep their label from G to ˜ G lab ). From Theorem 4, lab is a valid labeling if and only if ˜ G lab does not contain any cycle with at least one arc labeled (cid:9) , called forbidden cycle (it maycontain cycles with all arcs labeled ⊕ ). A path from i to j in ˜ G lab is called negative if itcontains at least one arc labeled (cid:9) , and positive otherwise. Definition 16. A source-sink labeled graph (ss-graph) ( G, α, β ) is a multigraph G with twodistinguished vertices α (cid:54) = β . A triple ( G, α, β ) with G a digraph such that ( ¯ G, α, β ) is ass-graph, is called an oriented ss-graph (oss-graph) . We can decompose the set of update digraphs (denoted UD ( G ) = { lab : A → {⊕ , (cid:9)} | lab is valid } ) into an oss-graph ( G, α, β ) , based on the follow sets. UD ( G ) + α → β = { lab ∈ UD ( G ) | there exists a path from α to β in ˜ G lab , and all paths from α to β in ˜ G lab are positive } UD ( G ) − α → β = { lab ∈ UD ( G ) | there exists a negative path from α to β in ˜ G lab } UD ( G ) ∅ α → β = { lab ∈ UD ( G ) | there exist no path from α to β in ˜ G lab } We define analogously UD ( G ) + β → α , UD ( G ) − β → α , UD ( G ) ∅ β → α , and partition UD ( G ) as:1. UD ( G ) + , + α,β = UD ( G ) + α → β ∩ UD ( G ) + β → α UD ( G ) + , ∅ α,β = UD ( G ) + α → β ∩ UD ( G ) ∅ β → α UD ( G ) − , ∅ α,β = UD ( G ) − α → β ∩ UD ( G ) ∅ β → α UD ( G ) ∅ , + α,β = UD ( G ) ∅ α → β ∩ UD ( G ) + β → α UD ( G ) ∅ , − α,β = UD ( G ) ∅ α → β ∩ UD ( G ) − β → α UD ( G ) ∅ , ∅ α,β = UD ( G ) ∅ α → β ∩ UD ( G ) ∅ β → α Notice that the three missing combinations, UD ( G ) + , − α,β , UD ( G ) − , + α,β and UD ( G ) − , − α,β , would alwaysbe empty because such labelings contain a forbidden cycle. For convenience let us denote8 u β ( G, α, β ) α β ( G , α , β ) α β S (( G, α, β ) , ( G , α , β )) α β P (( G, α, β ) , ( G , α , β )) α β F (( G, α, β ) , G ) Figure 6: Example of series and parallel compositions, and a free composition at u, β (cid:48) . S = { (+ , +) , (+ , ∅ ) , ( − , ∅ ) , ( ∅ , +) , ( ∅ , − ) , ( ∅ , ∅ ) } . Given any oss-graph ( G, α, β ) we have UD ( G ) = (cid:88) ( s,t ) ∈ S UD ( G ) s,tα,β (1)where UD ( G ) s,tα,β = | UD ( G ) s,tα,β | . Oss-graphs may be thought as black boxes, we will composethem using the values of UD ( G ) s,tα,β , regardless of their inner topologies. Definition 17.
We define three types of compositions (see Figure 6). • The series composition of two oss-graphs ( G, α, β ) and ( G (cid:48) , α (cid:48) , β (cid:48) ) with V ∩ V (cid:48) = ∅ , isthe oss-graph S (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) = ( D, α, β (cid:48) ) with D the one-point join of G and G (cid:48) identifying components β, α (cid:48) as one single component. • The parallel composition of two oss-graphs ( G, α, β ) and ( G (cid:48) , α (cid:48) , β (cid:48) ) with V ∩ V (cid:48) = ∅ ,is the oss-graph P (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) = ( D, α, β ) with D the two-points join of G and G (cid:48) identifying components α, α (cid:48) and β, β (cid:48) as two single components. • The free composition at v, v (cid:48) of an oss-graph ( G = ( V, A ) , α, β ) and a digraph G (cid:48) =( V (cid:48) , A (cid:48) ) with V ∩ V (cid:48) = ∅ , v ∈ V , v (cid:48) ∈ V (cid:48) , is the oss-graph F (( G, α, β ) , G (cid:48) ) = ( D, α, β ) with D the one-point join of G and G (cid:48) identifying v, v (cid:48) as one single component. Remark that the three types of compositions from Definition 17 also apply to (undirected)ss-graph ( ¯
G, α, β ) . Series and free compositions differ on the endpoints of the obtained oss-graph, which has important consequences on counting the number of update digraphs, asstated in the following results. We will see in Theorem 23 from Subsection 6.2 that bothseries and free compositions are needed in order to decompose the family of (general) orientedseries-parallel graphs (to be defined). Lemma 18.
For ( D, α, β (cid:48) ) = S (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) , the values of UD ( D ) s,tα,β (cid:48) for all ( s, t ) ∈ S can be computed in time O ( n log n log log n ) (with n the binary length of thevalues) from the values of UD ( G ) s,tα,β and UD ( G (cid:48) ) s,tα (cid:48) ,β (cid:48) for all ( s, t ) ∈ S .Proof. The result is obtained by considering the couples of some UD ( G ) s,tα,β with ( s, t ) ∈ S and some UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) with ( s (cid:48) , t (cid:48) ) . For example, when we take the union of any labeling lab in UD ( G ) + , ∅ α,β (in ˜ G lab there is at least one path from α to β , all paths from α to β positive, and no path from β to α ) and any labeling lab (cid:48) in UD ( G (cid:48) ) − , ∅ α (cid:48) ,β (cid:48) (in ˜ G (cid:48) lab (cid:48) there is anegative path from α (cid:48) to β (cid:48) , and no path from β (cid:48) to α (cid:48) ), we obtain a valid labeling of D with at least one negative path from α to β (cid:48) , and no path from β (cid:48) to α , hence an elementof UD ( D ) − , ∅ α,β (cid:48) . We can deduce that UD ( D ) − , ∅ α,β (cid:48) contains these UD ( G ) + , ∅ α,β UD ( G (cid:48) ) − , ∅ α (cid:48) ,β (cid:48) labelings.The results of this simple reasoning in all cases is presented on Table 1. This allows tocompute each value UD ( D ) s (cid:48)(cid:48) ,t (cid:48)(cid:48) α,β (cid:48) as the finite sum, for each line ( s, t ) and column ( s (cid:48) , t (cid:48) ) where9 + , + + , ∅ − , ∅ ∅ , + ∅ , − ∅ , ∅ + , + + , + + , ∅ − , ∅ ∅ , + ∅ , − ∅ , ∅ + , ∅ + , ∅ + , ∅ − , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅ − , ∅ − , ∅ − , ∅ − , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅∅ , + ∅ , + ∅ , ∅ ∅ , ∅ ∅ , + ∅ , − ∅ , ∅∅ , − ∅ , − ∅ , ∅ ∅ , ∅ ∅ , − ∅ , − ∅ , ∅∅ , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅ ∅ , ∅ Table 1: Row ( s, t ) corresponds to UD ( G ) s,tα,β , column ( s (cid:48) , t (cid:48) ) corresponds to UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) , andcell content ( s (cid:48)(cid:48) , t (cid:48)(cid:48) ) indicates that the union of any labeling in UD ( G ) s,tα,β and any labeling in UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) gives a labeling in UD ( D ) s (cid:48)(cid:48) ,t (cid:48)(cid:48) α,β (cid:48) for ( D, α, β (cid:48) ) = S (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) . P + , + + , ∅ − , ∅ ∅ , + ∅ , − ∅ , ∅ + , + + , + + , + + , + + , ++ , ∅ + , + + , ∅ − , ∅ + , + + , ∅ − , ∅ − , ∅ − , ∅ − , ∅∅ , + + , + + , + ∅ , + ∅ , − ∅ , + ∅ , − ∅ , − ∅ , − ∅ , − ∅ , ∅ + , + + , ∅ − , ∅ ∅ , + ∅ , − ∅ , ∅ Table 2: Row ( s, t ) corresponds to UD ( G ) s,tα,β , column ( s (cid:48) , t (cid:48) ) corresponds to UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) , andcell content ( s (cid:48)(cid:48) , t (cid:48)(cid:48) ) indicates that the union of any labeling in UD ( G ) s,tα,β and any labeling in UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) gives a labeling in UD ( D ) s (cid:48)(cid:48) ,t (cid:48)(cid:48) α,β for ( D, α, β ) = P (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) . Empty cellsmean that unions give invalid labelings. ( s (cid:48)(cid:48) , t (cid:48)(cid:48) ) appears, of the term UD ( G ) s,tα,β UD ( G (cid:48) ) s (cid:48) ,t (cid:48) α (cid:48) ,β (cid:48) . As an example we have UD ( D ) + , ∅ α,β (cid:48) = UD ( G ) + , + α,β UD ( G (cid:48) ) + , ∅ α (cid:48) ,β (cid:48) + UD ( G ) + , ∅ α,β UD ( G (cid:48) ) + , + α (cid:48) ,β (cid:48) + UD ( G ) + , ∅ α,β UD ( G (cid:48) ) + , ∅ α (cid:48) ,β (cid:48) . Summations on n bits are performed in linear time with schoolbook algorithm, and multiplications on n bitsare performed in time O ( n log n log log n ) from Schönhage–Strassen algorithm [36]. Lemma 19.
For ( D, α, β ) = P (( G, α, β ) , ( G (cid:48) , α (cid:48) , β (cid:48) )) , the values of UD ( D ) s,tα,β for all ( s, t ) ∈ S can be computed in time O ( n log n log log n ) (with n the binary length of the values) fromthe values of UD ( G ) s,tα,β and UD ( G (cid:48) ) s,tα (cid:48) ,β (cid:48) for all ( s, t ) ∈ S .Proof. The proof is analogous to Lemma 18, with Table 2. Remark that in this case, it ispossible to create invalid labelings for D (containing some forbidden cycle) from the unionof two valid labelings for G and G (cid:48) . For example, when we take the union of any labeling lab in UD ( G ) + , + α,β (in ˜ G lab there is at least one path from α to β , all paths from α to β positive,and the same from β to α ) and any labeling lab (cid:48) in UD ( G (cid:48) ) − , ∅ α (cid:48) ,β (cid:48) (in ˜ G (cid:48) lab (cid:48) there is a negativepath from α (cid:48) to β (cid:48) , and no path from β (cid:48) to α (cid:48) ), we obtain an invalid labeling of D becausethe concatenation of a positive path from α to β with a negative path from β (cid:48) to α (cid:48) gives aforbidden cycle in D (recall that α, α (cid:48) and β, β (cid:48) are identified).Note that Remark 15 also applies to Lemmas 18 and 19. For the free composition thecount is easier. 10 emma 20. For ( D, α, β ) = F (( G, α, β ) , G (cid:48) ) , we have UD ( D ) s,tα,β = UD ( G ) s,tα,β UD ( G (cid:48) ) forall ( s, t ) ∈ S .Proof. The endpoints of the oss-graph ( D, α, β ) are the endpoints of the oss-graph ( G, α, β ) ,and it is not possible to create a forbidden cycle in the union of a valid labeling on G and avalid labeling of G (cid:48) , therefore the union is always a valid labeling of D , each one belongingto the part ( s, t ) of ( D, α, β ) corresponding to the part ( s, t ) ∈ S of ( G, α, β ) . The series and parallel compositions of Definition 17 correspond exactly to the class of two-terminal series-parallel graphs from [1, 33, 39].
Definition 21.
A ss-graph ( G, α, β ) is two-terminal series-parallel (a ttsp-graph) if and onlyif one the following holds. • ( G, α, β ) is a base ss-graph with two vertices α, β and one edge { α, β } . • ( G, α, β ) is obtained by a series or parallel composition of two ttsp-graphs.In this case G alone is called a blind ttsp-graph. Adding the free composition allows to go from two-terminal series-parallel graphs to (gen-eral) series-parallel graphs [15, 39]. More precisely, it allows exactly to add tree structuresto ttsp-graphs, as we argue now (ttsp-graphs do not contain arbitrary trees, its only acyclicgraphs being simple paths; e.g. one cannot build a claw from Definition 21).
Definition 22.
A multigraph G is series-parallel (sp-graph) if and only if all its 2-connectedcomponents are blind ttsp-graphs. A digraph G such that ¯ G is an sp-graph, is called an oriented sp-graph (osp-graph) . The family of sp-graphs corresponds to the multigraphs obtained by series, parallel andfree compositions from base ss-graphs. See Figure 7 for an example G of osp-graph illustrat-ing Theorem 23, and the decomposition method to compute UD ( G ) (Theorem 24). Theorem 23. G is an sp-graph if and only if ( G, α, β ) is obtained by series, parallel andfree compositions from base ss-graphs, for some α, β .Proof sketch (see Appendix A). Free compositions allow to build all sp-graphs, because it of-fers the possibility to create the missing tree structures of ttsp-graphs: arbitrary 1-connectedcomponents linking 2-connected ttsp-graphs. Moreover free compositions do not go beyondsp-graphs, since the obtained multigraphs still have treewidth 2.
Theorem 24. is solvable in time O ( n log n log log n ) on osp-graphs (without promise).Proof sketch (see Appendix A). This is a direct consequence of Lemmas 18, 19 and 20, be-cause all values are in O (2 n ) (the number of {⊕ , (cid:9)} -labelings) hence on O ( n ) bits, the valuesof UD ( G ) s,tα,β are trivial for oriented base ss-graphs, and we perform O ( n log n ) compositions(to reach Formula 1). The absence of promise comes from a linear time recognition algorithmin [39] for ttsp-graphs, which also provides the decomposition structure.Again, Remark 15 applies to Theorem 24. With Definition 17 applied to (undirected) ss-graphs.
234 567 1 → → → → ← → ← → → S P P SF PF S + , + ∅ , ++ , ∅ ∅ , −− , ∅ ∅ , ∅ nomenclaturecounts0 01 10 0 0 01 10 0 0 01 10 0 0 01 10 0 0 10 01 0 0 01 10 0 0 10 01 0 0 01 10 00 01 10 00 01 10 2 0 03 30 0 1 00 11 0 0 00 11 20 09 90 0 0 02 31 00 054 540 0 0 054 540 108 Figure 7: An example G of osp-graph (left), and an illustration of the decomposition method(Theorem 24) computing UD ( G ) = 216 based on the values of UD ( G ) s,tα,β for all ( s, t ) ∈ S ,from the oriented base ss-graphs (leaf nodes) to G (root of the decomposition tree). Our main result is the P -completeness of , i.e. of counting the number of non-equivalent block-sequential update schedules of a given AN f . We proved that this count cannevertheless be done in O ( n log n log log n ) time for oriented cacti, and in O ( n log n log log n ) time for oriented series-parallel graphs. This last result has been obtained via a decomposi-tion method providing a divide-and-conquer algorithm.Remark that cliques or tournaments are intuitively difficult instances of , becauseof the intertwined structure of potential forbidden cycles. It turns out that K is the smallestclique that cannot be build with series, parallel and free decompositions, and that series-parallel graphs (Definition 22) correspond exactly to the family of K -minor-free graphs [15](it is indeed closed by minor [35]). In further works we would like to extend this caracteri-zation and the decomposition method to (di)graphs with multiple endpoints.The complexity analysis of the algorithms presented in Theorems 14 and 24 may be im-proved, and adapted to the parallel setting using the algorithms presented in [9, 23]. Onemay also ask for which other classes of digraphs is UD ( G ) computable efficiently (in poly-nomial time)? Since we found such an algorithm for graphs of treewidth 2, could it be thatthe problem is fixed parameter tractable on bounded treewidth digraphs? Rephrased moredirectly, could a general tree decomposition (which, according to the proof of Theorem 23, isclosely related to the series-parallel decomposition for treewidth 2) be exploited to computethe solution to ? Alternatively, what other types of decompositions one can considerin order to ease the computation of UD ( G ) ?Finally, from the multiplication obtained for one-point join of two graphs (Lemma 20 onfree composition), we may ask whether UD ( G ) is an evaluation of the Tutte polynomial?From its universality [11], it remains to know whether there is a deletion-contradiction re-duction. However defining a Tutte polynomial for directed graphs is still an active area ofresearch [7, 13, 32, 42]. 12 cknowledgments This work was mainly funded by our salaries as French agents (affil-iated to Laboratoire Cogitamus (CN), Aix-Marseille Univ, Univ. de Toulon, CNRS, LIS,UMR 7020, Marseille, France (KP, SS and LV), Univ. Côte d’Azur, CNRS, I3S, UMR 7271,Sophia Antipolis, France (KP), and École normale supérieure de Lyon, Computer Sciencedepartment, Lyon, France (LV)), and secondarily by the projects ANR-18-CE40-0002 FANs,ECOS-CONICYT C16E01, STIC AmSud 19-STIC-03 (Campus France 43478PD).
References [1] A. Ádám. On graphs in which two vertices are distinguished.
Acta MathematicaAcademiae Scientiarum Hungaricae , 12:377–397, 1964.[2] J. Aracena, J. Demongeot, É. Fanchon, and M. Montalva. On the number of differ-ent dynamics in Boolean networks with deterministic update schedules.
MathematicalBiosciences , 242:188–194, 2013.[3] J. Aracena, J. Demongeot, É. Fanchon, and M. Montalva. On the number of updatedigraphs and its relation with the feedback arc sets and tournaments.
Discrete AppliedMathematics , 161:1345–1355, 2013.[4] J. Aracena, É. Fanchon, M. Montalva, and M. Noual. Combinatorics on update digraphsin Boolean networks.
Discrete Applied Mathematics , 159:401–409, 2011.[5] J. Aracena, E. Goles, A. Moreira, and L. Salinas. On the robustness of update schedulesin Boolean networks.
Biosystems , 97:1–8, 2009.[6] J. Aracena, L. Gómez, and L. Salinas. Limit cycles and update digraphs in Booleannetworks.
Discrete Applied Mathematics , 161:1–12, 2013.[7] J. Awan and O. Bernardi. Tutte polynomials for directed graphs.
Journal of Combina-torial Theory, Series B , 140:192–247, 2020.[8] H. L. Bodlaender. A partial k-arboretum of graphs with bounded treewidth.
TheoreticalComputer Science , 209(1):1–45, 1998.[9] H. L. Bodlaender and B. de Fluiter. Parallel algorithms for series parallel graphs. In
Proceedings of ESA’96 , volume 1136 of
LNCS , pages 277–289, 1996.[10] F. Bridoux, C. Gaze-Maillot, K. Perrot, and S. Sené. Complexity of limit-cycle problemsin Boolean networks. arXiv:2001.07391, 2020.[11] T. H. Brylawski. A decomposition for combinatorial geometries.
Transactions of theAmerican Mathematical Society , 171:235–282, 1972.[12] R. E. Burkard and J. Krarup. A linear algorithm for the pos/neg-weighted 1-medianproblem on a cactus.
Computing , 60:193–215, 1998.1313] S. H. Chan. Abelian sandpile model and Biggs-Merino polynomial for directed graphs.
Journal of Combinatorial Theory, Series A , 154:145–171, 2018.[14] B. de Fluiter.
Algorithms for graphs of small treewidth . PhD thesis, University ofUtrecht, 1997.[15] R. J. Duffin. Topology of series-parallel networks.
Journal of Mathematical Analysisand Applications , 10:303–318, 1965.[16] B. Elspas. The theory of autonomous linear sequential networks.
IRE Trans. CircuitTheory , 6:45–60, 1959.[17] N. Fatès. A guided tour of asynchronous cellular automata.
Journal of Cellular Au-tomata , 9:387–416, 2014.[18] M. Fürer. Faster Integer Multiplication. In
Proceedings of STOC’07 , pages 57–66, 2007.[19] E. Goles, D. Maldonado, P. Montealegre, and M. Ríos-Wilson. On the complexity ofasynchronous freezing cellular automata. arXiv:1910.10882, 2019.[20] D. Harvey and J. Van Der Hoeven. Integer multiplication in time O(n log n). HAL:hal-02070778, 2019.[21] J. Hopcroft and R. Tarjan. Algorithm 447: efficient algorithms for graph manipulation.
Communications of the ACM , 16:372–378, 1973.[22] D. A. Huffman. Canonical forms for information-lossless finite-state logical machines.
IRE Trans. Inform. Theory , 5:41–59, 1959.[23] J. Jájá.
An introduction to parallel algorithms . Addison-Wesley, 1992.[24] S. A. Kauffman. Homeostasis and differentiation in random genetic control networks.
Nature , 224:177–178, 1969.[25] S. C. Kleene. Representation of events in nerve nets and finite automata. Project RANDRM–704, US Air Force, 1951.[26] N. Linial. Hard enumeration problems in geometry and combinatorics.
SIAM Journalon Algebraic Discrete Methods , 7:331–335, 1986.[27] P. A. MacMahon. The combinations of resistances.
The Electrician , 28:601–602, 1892.[28] W. S. McCulloch and W. Pitts. A logical calculus of the ideas immanent in nervousactivity.
Journal of Mathematical Biophysics , 5:115–133, 1943.[29] M. Noual and S. Sené. Synchronism versus asynchronism in monotonic Boolean au-tomata networks.
Natural Computing , 17:393–402, 2018.[30] K. Perrot. On the complexity of counting feedback arc sets. arXiv:1909.03339, 2019.1431] K. Perrot, M. Montalva-Medel, P. P. B. de Oliveira, and E. L. P. Ruivo. Maximum sen-sitivity to update schedule of elementary cellular automata over periodic configurations.
Natural Computing , 19:51–90, 2020.[32] K. Perrot and V. T. Pham. Chip-firing game and partial Tutte polynomial for Euleriandigraphs.
Electronic Journal of Combinatorics , 23(1), 2016.[33] J. Riordan and C. E. Shannon. The number of two-terminal series-parallel networks.
Journal of Mathematics and Physics , 21:83–93, 1942.[34] F. Robert. Blocs-H-matrices et convergence des méthodes itératives classiques par blocs.
Linear Algebra and its Applications , 2:223–265, 1969.[35] N. Robertson and P. D. Seymour. Graph Minors. XX. Wagner’s conjecture.
Journal ofCombinatorial Theory, Series B , 92:325–357, 2004.[36] A. Schönhage and V. Strassen. Schnelle Multiplikation großer Zahlen.
Computing ,7:281–292, 1971.[37] B. Schwikowski and E. Speckenmeyer. On enumerating all minimal solutions of feedbackproblems.
Discrete Applied Mathematics , 117:253–265, 2002.[38] R. Thomas. Boolean formalization of genetic control circuits.
Journal of TheoreticalBiology , 42:563–585, 1973.[39] J. Valdes, R. E. Tarjan, and E. L. Lawler. The recognition of series parallel digraphs.In
Proceedings of STOC’79 , pages 1–12, 1979.[40] J. Valdes Ayesta.
Parsing Flowcharts and Series-Parallel Graphs . PhD thesis, StanfordUniversity, 1978.[41] J. A. Wald and C. J. Colbourn. Steiner trees, partial 2-trees, and minimum IFI networks.
Networks , 13:159–167, 1983.[42] K. S. Yow.
Tutte-Whitney polynomials for directed graphs and maps . PhD thesis,Monash University, 2019.
A Full proofs for the application of the decompositionmethod to oriented series-parallel graphs
The concept of decomposition tree associated to ttsp-graphs, and generalized to sp-graphs,will be useful to formalize the reasonings leading to Theorems 23 and 24.The structure of a ttsp-graph ( G = ( V, E ) , α, β ) obtained from base ss-graphs by seriesand parallel compositions is expressed in a ttsp-tree T G = ( N, F, σ : N → V × V ) . It is arooted binary tree, in which each node η ∈ N has one of the types s-node , p-node , leaf-node ,and a label σ ( η ) consisting in a pair of vertices from G . Every node η ∈ N correspondsto a unique ttsp-graph ( G (cid:48) , α (cid:48) , β (cid:48) ) which is a subgraph of G , with σ ( η ) = ( α (cid:48) , β (cid:48) ) . The15 s p p s f p f s Figure 8: Example sp-tree (left) and the corresponding sp-graph (right).leaves of the tree are of type leaf-node and correspond to base ss-graphs, they are in one-to-one correspondence with the edges of G . The ss-graph associated to an s-node is theseries composition of its (ordered) children, and the ss-graph associated to a p-node is theparallel composition of its (unordered) children. It is worth noticing that each ttsp-graphcorresponds to at least one ttsp-tree (and possibly to many ttsp-trees, even non isomorphicones [39, Section 2.2]), and that each ttsp-tree corresponds to a unique ttsp-graph.To this classical definition (presented for example in [39, 14]), we add f-nodes correspond-ing to free compositions, leading to sp-trees , as follows. The subtlety is that the two distin-guished vertices of one children of a free composition are discarded. Let ( G = ( V, E ) , α, β ) and ( G (cid:48) = ( V (cid:48) , E (cid:48) ) , α (cid:48) , β (cid:48) ) be the (ordered) children of an f-node η of label σ ( η ) = ( v, v (cid:48) ) with v ∈ V and v (cid:48) ∈ V (cid:48) , the ss-graph associated to this f-node is the free composition F (( G, α, β ) , G (cid:48) ) (its label does not correspond to the distinguished vertices of the ss-graph).Every node η ∈ N still corresponds to a unique ttsp-graph ( G (cid:48) , α (cid:48) , β (cid:48) ) which is a subgraph of G , with σ ( η ) = ( α (cid:48) , β (cid:48) ) for all but f-nodes; and for f-nodes the distinguished vertices are thatof its first (left on our figures) child. We have the same correspondence between sp-graphsand sp-trees. An example is given on Figure 8.Now remark that all free compositions may be performed at the end of the compositionprocess, i.e. on top of the sp-tree. Indeed, free compositions can be inductively pushedtowards the root of an sp-tree using the operations presented on Figure 9, which leave thesp-graph unchanged. When all free compositions are on top of an sp-tree, we say that itis in free-on-top normal form . Thus to any sp-graph corresponds at least one sp-tree infree-on-top normal form. Proof of Theorem 23.
For the “only if” part, let G be an sp-graph, with G , . . . , G x its 2-connected components, H , . . . , H y its remaining connected components (which are thereforetrees), and w , . . . , w z the set of vertices belonging to two 2-connected components among G , . . . , G x . By definition G , . . . , G x are blind ttsp-graphs, to which we can respectivelyassociate some ttsp-trees T G , . . . , T G x , which are particular cases of sp-trees. Now, take anedge { u, v } of H i sharing: • only one vertex with some T G j , and consider the free composition of T G j with the basess-graph corresponding to edge { u, v } (joining them at that vertex), we get an sp-tree16 u v (cid:5) u v T T T →(cid:5) ∈ { s, p } (cid:5) u v f u vT T T s p s p s f p f Figure 9: Two operations on sp-trees, pushing free compositions towards the root (left).The resulting sp-tree corresponds to the same sp-graph, leading by induction to an sp-treein free-on-top normal form. Sp-tree in free-on-top normal form (right) corresponding to thesp-graph of Figure 8.replacing T G j , • its two vertices with respectively some T G j and T G j (cid:48) , and consider first the free com-position of T G j with the base ss-graph corresponding to edge { u, v } (joining them at u ), this gives T (cid:48) G j , and second the free composition of T (cid:48) G j with T G j (cid:48) (joining them at v ), we get an sp-tree replacing both T G j and T G j (cid:48) ,or take a vertex w i and: • consider the free composition of the two sp-trees to which w i belongs (joining them at w i ), we get a new sp-tree replacing them.Repeating this process for all edges of H , . . . , H y and all vertices w , . . . , w z , we inductivelybuild an sp-tree corresponding to ( G, α, β ) , for some α, β . Indeed, since G is connectedand H , . . . , H y are only 1-connected components, all edges of H , . . . , H y will inductively beadded to the sp-trees, and from the maximality of 2-connected components G , . . . , G x thefree compositions given by w i always joins two sp-trees that are distinct. Consequently thisprocess will eventually merge all ttsp-trees into a unique sp-tree corresponding to the wholess-graph ( G, α, β ) (at this point α, β could be the distinguished vertices of any ttsp-treeamong T G , . . . , T G x , and the resulting sp-tree is in free-on-top normal form).For the “if” part, let ( G, α, β ) be obtained by series, parallel and free compositions frombase ss-graphs, with T G a corresponding sp-tree in free-on-top normal form. Thanks to thefree-on-top normal form, we can adapt the tree decomposition presented in [14, Lemma2.3.5] in order to prove that G has treewidth at most 2. Let T G = ( N , F , σ ) , . . . , T xG =( N x , F x , σ x ) denote the forest of ttsp-trees excluding free compositions (but including all basess-graphs). We construct the tree decompositions ( X , T G ) , . . . , ( X x , T xG ) for the ttsp-graphsrespectively corresponding to T G , . . . , T xG , as follows: X i = { X iη | η ∈ N i } and • for each p-node η ∈ N i of label ( α, β ) , set X iη = { α, β } , • for each s-node η ∈ N i of label ( α, β ) and labels of its two children ( α, γ ) and ( γ, β ) ,set X iη = { α, β, γ } . 17he tree structure of each tree decomposition is directly given by the ttsp-tree. It remainsto assemble these tree decompositions according to the free compositions, in order to obtaina tree decomposition of G . For each f-node of label ( v, v (cid:48) ) , i.e. identifying vertices v, v (cid:48) ofits children, one can simply add an edge merging two tree decompositions into a single treedecomposition, between any bag containing v and any bag containing v (cid:48) (and rename v (cid:48) as v ). The result ( X, T ) of this process is indeed a tree decomposition of G : • the obtained graph T is a tree, as at each step two distinct trees are merged, • all base ss-graphs (which are leaf-nodes of T G ) belong to ttsp-graphs, hence all edgesof G are covered in some bag of the tree decompositions ( X , T G ) , . . . , ( X x , T xG ) , • the subtree associated to each vertex is connected, because it was connected in treedecompositions ( X , T G ) , . . . , ( X x , T xG ) , and the merge of two tree decompositions con-nects identified vertices.Since ( X, T ) has bags of size at most 3, it follows that the treewidth of G is at most 2.From [8, 15, 41], the family of graphs of treewidth at most 2 equals the family of sp-graphs(via the equality with K -minor-free and partial 2-trees ), thus G is an sp-graph. Proof of Theorem 24.
Given a directed graph G , one can identify in linear time the 2-connected components of ¯ G (from [21]), and check in linear time that each of them is ablind ttsp-graph (from [39, Section 2.3 and Section 3.3 for implementation details] whichis based on the characterization as series-parallel reducible multigraphs from [15] and itsChurch-Rosser property, with the blind undirected graph oriented as in [40, Chapter 3.5]).This last algorithm also builds a ttsp-tree for each 2-connected component. In order to getan sp-tree for the whole graph, it remains to include the free compositions as in the “if” partof the proof of Theorem 23, which is also done in linear time. We are now equipped withan sp-tree (in free-on-top normal form, which is not a necessary feature) corresponding to ¯ G (in the case G is an osp-graph, otherwise we reject the instance).The second (and main) part of the algorithm is a direct application of Lemmas 18, 19and 20. For a base ss-graph H with an edge oriented as ( u, v ) we have UD ( H ) + , + u,v = UD ( H ) − , ∅ u,v = UD ( H ) ∅ , + u,v = UD ( H ) ∅ , ∅ u,v = 0 and UD ( H ) + , ∅ u,v = UD ( H ) ∅ , − u,v = 1 , then by induction on the structure of the sp-tree of ¯ G (which provides two distinguishedvertices for the osp-graph corresponding to each node of the sp-tree) we apply Lemma 18for s-nodes, Lemma 19 for p-nodes, and Lemma 20 for f-nodes. There are O ( n log n ) stepswith n the size of the input graph, because the sp-tree has one leaf-node for each arc of G and is a binary tree. Finally, all values counting some number of labelings are in O (2 n ) (the number of {⊕ , (cid:9)} -labelings of the whole input digraph G ), hence on O ( n ))