An Algorithm for Counting the Fixed Point Orbits of an AND-OR Dynamical System with Symmetric Positive Dependency Graph

In this paper we present an algorithm which counts the number of fixed point orbits of an AND-OR dynamical system. We further extend the algorithm in order to list all its fixed point orbits (FPOs) in polynomial time on the number of FPOs of the system.


Introduction and Preliminaries
A directed graph G is a couple G = (V(G), E(G)) where V(G) is a set of vertices and E(G) ⊆ V(G) × V(G) is a set of directed edges. In our setting, each edge (u, v) is labeled positive or negative. The set of positive (resp. negative) edges of the graph are denoted by E + (G) (resp. E − (G)). A graph is called positive (resp. negative) if all labels on the edges are positive (resp. negative). If S ⊆ V(G), the subgraph of G induced by S, denoted as G(S), is the graph whose vertices set is V(G(S)) = S and its edge set is E(G(S)) = {(u, v) ∈ E(G)|{u, v} ⊆ S}. We denote by G − S the subgraph of G induced by V(G) \ S.
A graph is undirected if for every (u, v) ∈ E(G) then (v, u) ∈ E(G). A graph is symmetric if it is undirected and for every v ∈ V(G) then (v, v) ∈ E(G). That is, a symmetric graph is an undirected graph where each vertex has a (directed) selfloop.
If (u, v) is an edge then we say that u is a predecessor of v and it is positive (resp. negative) if (u, v) is a positive (resp. negative) edge. The set of positive (resp. negative) predecessors of a vertex v is denoted as P + The degree of a vertex is the number of vertices in its closed neighborhood and it is denoted by δ G (v) = |N G [v]|.
A dynamical system (DS) [1][2][3][4] or Boolean Network (BN) [5][6][7] S is a couple S = (G, F) where G is a directed graph called the dependency graph, F is a set of functions F = { f v |v ∈ V(G)} as defined below. We also define a |V(G)|-dimensional vector O of states. O = (o 1 , o 2 , . . . , o n ) where o v ∈ {0, 1}, v ∈ V(G). The vector O will be referred as an orbit of S. We also consider the restriction (or the projection) of the vector O on a subset of vertices W ⊆ V(G) and we refer to it as O W . Each function f v : {0, 1} h → {0, 1} is taken from the set of Boolean functions, where h is the number of predecessors of v. The argument of f v is an h-dimensional vector x = (x u 1 , . . . , x u h ) where x u i = o u i when u i ∈ P + G (v), and, x u i = o u i when u i ∈ P − G (v) being o u i the Boolean negation (or the complement modulo 2) of o u i . Although f v can be an arbitrary Boolean function on h variables, most pieces of research on DS and BN restrict the set of Boolean functions to AND, OR, NAND and NOR. This is motivated by the following.
An AND term (resp. OR term) is the logical AND (resp. logical OR) of a set of variables (where each variable can be either complemented or not complemented). Given a set of h Boolean variables x 1 , . . . , x h , an AND term in which each of the h variables appears once (in either its complemented or not complemented form) is called a minterm. Analogously, an OR term in which each of the h variables appears once (in either its complemented or not complemented form) is called a maxterm. It is well known that every Boolean function can be expressed either by disjunction of uniquely minterms or by conjunction of just maxterms, among others. Furthermore, it is well known that the Boolean algebra using the binary operators AND, OR and NOT are equivalent to the algebra obtained by using either only NAND or only NOR.
In addition, the complexity of the problems involved in a DS dramatically changes when we modify either the structure of the dependency graph, or the type or distribution of the Boolean functions involved in the system. If the vertices of a DS use a function on a set F then we refer to the dynamical system as an F -DS. We also call a DS positive when its dependency graph is positive.
Given a vertex v of a DS, we may consider the state of the vertex o v as a function of a discrete time t ∈ N. Consequently, the global state O of the DS depends also on the time t. At time t = 0, we assign a value to each o v and if O(t) is the state of DS at time t then the state of a single vertex at time t + 1 will be o is the restriction of O to the predecessors of v. If the states of the vertices are updated in parallel then we refer to the system as a parallel DS or PDS. In other settings, we want to update the state of exactly one vertex at time t. A permutation π = {v 0 , . . . , v n−1 } of the vertices is given and if v i is the vertex that is updated at time t then only v i+1 (indices taken modulo n) will change its state at time t + 1 and thus . In this case, we call the system a sequential DS or SDS.  [2][3][4][8][9][10]. In addition, the FPOE problem in an {AND, OR, NAND, NOR}-DS is polynomially solvable as shown in [4,11]. However, for {NAND, XNOR}-DS, {NAND, XOR}-DS,{NOR, XNOR}-DS and {NOR, XOR}-DS, the FPOE problem is NP-complete [11]. The problem of counting the fixed point orbits in a DS whose dependency graph is symmetric and all edges are positive is studied in [6] where it is proved that the problem of counting the FPOs in a F -DS is #P-complete under the hypothesis that the function associated to each node is arbitrary.
When the constraints that require the graph to be symmetric and positive are released, then the FPOE problem will be NP-complete in {AND, OR}-DS [12,13]. It remains NP-Complete even when the indegree of each vertex is at most two [13]. It can be demonstrated that the problem remains NP-complete for {AND}-DS with all negative edges by using the transformation given in [5].
In this paper, we present an algorithm for counting the FPOs in an AND-OR symmetric positive PDS. The algorithm has been designed by using more or less standard methodologies (such as the one used also in [14][15][16][17][18][19][20][21][22][23]) and by using both a greedy strategy and recursion. The paper is organized as follows. In Section 2, we present some theoretical results about AND-OR PDS whose dependency graph is symmetric and positive. Based on them, we present an algorithm for counting all FPOs in AND-OR symmetric positive PDS and we prove its correctness. In Section 3, we further develop the algorithm given in Section 2 for building an algorithm which lists all FPOs in AND-OR symmetric PDS.

Algorithm for Computing the Number of FPOs in AND-OR Symmetric Positive PDS
In this section, we first determine the structure and the number of FPOs in {AND, OR}-DS whose dependency graph is symmetric and positive. It is well known that for this kind of graph the FPOE problem is polynomially solvable [2,3]. Let S = (G, F) be an {AND, OR}-DS where G is a symmetric positive graph. We denote by V OR (resp. V AND ) the vertices of G such that f v is OR (resp. AND). Furthermore, if for a vertex v we have that f v = OR (resp. f v = AND) we refer to v as an OR vertex (resp. AND vertex).
Since, in the following, we will limit our discussion to symmetric positive {AND, OR}-DS, for brevity we will often refer to them as DS without explicitly specifying that the dependency graph is symmetric positive and the set of Boolean functions F ={AND, OR}. Lemma 1. Let S be a DS and let O be an FPO of S. Let U ⊆ V(G) and let S be a DS whose dependency graph is G(U). Then O U is an FPO of S .
We will refer to B G as the AND-OR bipartition of G. Furthermore we associate to S an {AND, OR}-DS S = (B G , F ) referred to as the bipartite contraction Let us notice that S = (B G , F ) can be achieved from S = (G, F) just computing the connected components within the sub-graphs associated to G − V AND and to G − V OR . In order to do this it is sufficient with contracting all the vertices belonging to the same connected component in one.
The computational cost associated to this process is O(n) being n = |E(G)| + |V(G)|. For example, in Figure 1 on the left, there is an {AND, OR}-DS in which AND vertices are shaded grey and OR vertices are shaded white, whereas on the right its bipartite contraction appears.
. Let us suppose that C ∈ A (the proof of the case in which C ∈ B is similar and omitted). By this assumption it cannot be that o C (t) = 1 because otherwise o C (t + 1) = 1 since B G is symmetric and positive and f C =OR. Therefore, we have that o C = 0 and C is adjacent, in B G , to a vertex C such that o C = 1. Then, by definition of bipartite contraction, there exists a vertex u ∈ V(C) and a vertex v ∈ C such that (v, u) ∈ E(G) and, by what said above, o u = 0 and o v = 1. Furthermore u ∈ V OR . Then o u (t) = o u (t + 1) and O would not be an FPO of S (a contradiction to the hypothesis). Proof. By Lemmas 4 and 5, there is a surjective relation from the set of FPOs of S and the set of FPOs of S . Therefore, we simply need to show that this relation is injective. That is, whenever we have two distinct FPOs O 1 and O 2 of S, then the corresponding orbits O 1 and O 2 in S are distinct and vice versa. This is straightforward to prove and is left to the reader.
The following algorithm will compute the number of FPOs of S = (G, F). In order to manage the base case we admit null graphs G (that is, graphs in which V(G) = ∅) where we assume that null graphs have exactly one FPO (the empty vector). Base. If n = 1 then there is only one connected component in B G , that is, either all the vertices in G are OR vertices or all of them are AND vertices. By [2], there are only 2 FPOs in the DS. In this case, the algorithm will make two recursive calls with empty graphs as arguments, so returning 1 + 1 = 2. Thus, in the base case the algorithm is correct.
Induction. Let us suppose the algorithm correctly computes the number of FPOs of these DSs having graphs up to n − 1 vertices. Let B G be a graph with n vertices and let v ∈ V(B G ) be an OR vertex (v being an AND vertex requires so similar reasoning that it is omitted). In order to prove this part it is sufficient to show (1)    if V(B G ) = ∅ then return 1 3: let v ∈ V(B G ) 4: return FP 6: end procedure

Algorithm for Listing All FPO in AND-OR Symmetric PDS
In this section, we provide a lower bound on Algorithm 1 and, based on it, we present an algorithm for listing all the FPOs of an AND-OR symmetric PDS.
We have the following: Lemma 7. Let S be a DS and let S = (B G , F ) be the bipartite contraction of S. If (A, B) is the bipartition of B G , then the number of FPOs of S is FP ≥ 2 |A| + 2 |B| − 1.
Proof. By Lemma 6, it is sufficient to prove that FP ≥ 2 |A| + 2 |B| − 1 where FP is the number of FPOs in the bipartite contraction S of S. Let O be an orbit of S such that for all a ∈ A we have that o a = 1. We also have the following result.

It is easy to check that if for any
Lemma 8. Let S be a DS and let S = (B G , F ) be the bipartite contraction of S. If B G is a complete bipartite graph K n,m , then the number of FPOs of S equals 2 n + 2 m − 1.
Proof. By Lemma 6, it is sufficient to prove that FP = 2 n + 2 m − 1 where FP is the number of FPOs in the bipartite contraction S of S. Let (A, B) be the bipartition of B G where A is the set of OR vertices. Suppose w.l.o.g. that |A| = n and |B| = m. We show that given an FPO O of S , only one of the following two cases can happen: (i) o v = 1 for all v ∈ A or (ii) o u = 0 for all u ∈ B. Suppose not and let O be an FPO in which there is a vertex v ∈ A and a vertex u ∈ B such that o v = 0 and o u = 1. Since B G is complete, v is adjacent to u so that o v (t) = o v (t + 1) and o u (t) = o u (t + 1) a contradiction to the hypothesis that O is an FPO. Now, it is easy to see that in case (i), if we assign to each vertex in B any binary value, the orbit we obtain is a fixed point of S (the same reasoning applies to case (ii)).
Since there are, in case (i), 2 m of such orbits (2 n in case (ii)), the statement follows by the fact that the FPO O in which o v = 1 for all v ∈ A and o u = 0 for all u ∈ B is present in both counts.
By Lemma 8, when the bipartite contraction of a DS is complete, listing all its FPOs requires a very simple algorithm for listing all the binary strings of a prefixed length. Therefore, in the following, we always assume that the bipartite contraction of a DS is not complete.
The Algorithm 1 can be modified in order to list in polynomial time all the FPOs of an {AND, OR}-DS whose dependency graph is symmetric positive as reported in Algorithm 2. Let n = |A ∪ B|. The algorithm calls itself in line 7 and in line 11 and the argument, in each of the recursive call, is a graph with n − 1 vertices, in the worst case. The for cycle (lines 9-10) takes at most O(δ B G (v)) times. Now we can have two cases: (i) in B G the degree δ B G (v) of any vertex v is bounded by a constant c and (ii) δ B G (v) is not bounded by constant, that is, we have that δ B G (v) = O(n) so we can find a constant 0 < k < 1 such that δ B G (v) ≤ kn for every v ∈ V(B G ).
Therefore, in case (i), the recursive relation of the time T(n), the algorithm spends for listing all the FPOs is: T(n) = T(n − 1) + T(n − c) + c ≤ 2T(n − 1) + c Assuming that T(0) = 1, clearly this recursion solves in T(n) ≤ (c + 1)2 n − c, so that the algorithm has O(2 n ) complexity. In case (ii), the recursive relation is T(n) = T(n − 1) + T(n − kn) + kn (2) So we have that T(n) ≤ 2T(n − 1) + kn The above recursion solves in T(n) ≤ k(2 n+1 − n − 2) so that the algorithm has O(2 n ) complexity. By Corollary 1, we have that the number of FPOs is not less than 2 n/2+1 and this completes the proof.
As an example of the output of the algorithm, we refer to the table on the right hand side of Figure 2.

Conclusions
We presented an algorithm for counting all the FPOs of an {AND, OR}-DS whose dependency graph is symmetric positive. We gave a lower bound on that number. Furthermore, we adapted the algorithm in order to list all the FPOs of the system taking for it polynomial time on the length of the output, and linear space over the same parameter.