Theoretical and Experimental DNA Computation (Natural ...
Theoretical and Experimental DNA Computation (Natural ...
Theoretical and Experimental DNA Computation (Natural ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4.8 Example Application: Transitive Closure 89<br />
we concentrate on the all-pairs transitive closure problem. Here, we find all<br />
pairs of vertices in the input graph that are connected by a path.<br />
The transitive closure of a directed graph G =(V,E) is the graph G ∗ =<br />
(V,E ∗ ), where E ∗ consists of all pairs , such that either i = j or there<br />
exists a path from i to j. An example graph G is depicted in Fig. 4.7a with<br />
its transitive closure G ∗ depicted in Fig. 4.7b.<br />
1 2<br />
5<br />
3 4<br />
(a)<br />
1 2<br />
5<br />
3 4<br />
(b)<br />
Fig. 4.7. (a) Example graph, G. (b) Transitive closure of G<br />
We represent G by its adjacency matrix, A. LetA ∗ be the adjacency matrix<br />
of G ∗ .In[83],JàJà shows how the computation of A ∗ may be reduced to<br />
computing a power of a Boolean matrix.<br />
We now describe the structure of a NAND gate Boolean circuit to compute<br />
the transitive closure of the n×n Boolean matrix A. For ease of exposition<br />
we assume that n =2 p .<br />
The transitive closure, A ∗ ,ofA is equal to (A + I) n ,whereI is the n × n<br />
identity matrix. This is computed by p =log 2 n levels. The i th level takes<br />
as input the matrix output by level i − 1 (with level 1 accepting the input<br />
matrix A + I) <strong>and</strong> squares it: thus level i outputs a matrix equal to (A + I) 2i<br />
(Fig. 4.8).<br />
To compute A 2 given A, then 2 Boolean values A 2 i,j<br />
(1 ≤ i, j ≤ n) are<br />
needed. These are given by the expression A2 i,j =<br />
n<br />
∨<br />
k=1Ai,k ∧ Ak,j. First, all the<br />
n3 terms Ai,k ∧ Ak,j (for each 1 ≤ i, j, k ≤ n) are computed in two (parallel)<br />
steps using two NAND gates for each ∧-gate simulation. Using NAND gates,<br />
we have x ∧ y = NAND(NAND(x, y),NAND(x, y)). The final stage is to<br />
n<br />
∨<br />
k=1 (Ai,k ∧ Ak,j) that form the input to the<br />
compute all of the n2 n-bit sums<br />
next level.<br />
n<br />
∨<br />
The n-bit sum k=1 xk, can be computed by a NAND circuit comprising<br />
p levels each of depth 2. Let level 0 be the inputs x1,...,xn; level i has 2p−i outputs y1,...,yr, <strong>and</strong>leveli + 1 computes y1 ∨ y2,y3 ∨ y4,...,yr−1 ∨ yr.