• 沒有找到結果。

In this chapter, we will propose algorithms to solve some related digraph problems and these algorithms are based on the idea of our all-pairs shortest distance algorithm. These algorithms show the capability of our idea and we think it would be an important funda-mental algorithm for solving other digraph problems in the future.

5.1 Introduction

In this chapter, we will extend our all-pairs shortest distance algorithm to solve some re-lated digraph problems. By adding extra steps at the end of our all-pairs shortest distance algorithm, diameter and topological sort can be solved easily. The single-source shortest distance problem can also be solved directly by our all-pairs shortest distance algorithm.

As we showed in Chapter 4, we generated all single-source shortest distances as our fi-nal result of all-pairs shortest distance algorithm, so the single-source shortest distances problem is solved in the same time. Because the steps are similar, the details will be omit-ted. But the main differences among these algorithms will be explained below. Finally, we found that all-pairs shortest distance, single-source shortest distance, diameters, and topological sort problems are logical equivalent.

As we showed in Chapter 4, we generated all single-source shortest distances as our final result of all-pairs shortest distance algorithm, so the single-source shortest distances problem is solved in the same time. The users only need to decide which vertex as the source node and output the corresponding result.

Theorem 5.2.1 The single source shortest distance problem on digraph can be solved in O(log d(D)) time on a 3-D n×n×n1+non-directional reconfigurable mesh, whered(D) is the diameter of the digraphD.

Proof The proof of this theorem is similar to Theorems 2.2.1, 4.2.1 and 4.2.2, so the detail steps are omitted. The only difference is that the MIN function will be replaced with a constant-time minimum finding algorithm on a 2-D n × n R-Mesh. So the time complexity will be O(log d(D)). Because we do need the reachable information from all vertices, so the number of processors can not be reduced further. That is the disadvantage of this algorithm.

5.3 Diameter Algorithm

The maximum distance of shortest directed paths of digraph D is called the diameter of digraph D. If any pair of vertices in D has a shortest directed path, then there are at most n × (n − 1) pairs. After we got the all-pairs shortest distances, we can use the SORT function in [30], which can sort n2numbers by using O(1) time on a 3-D n×n×n processors R-Mesh, to find the maximum distance among the n×(n − 1) values except ∞.

An example is shown in Figure 5.1 and we find the diameter of this example is equal to

in these n×(n − 1) values.

V1 V2 V3

V4 V5 V6

Figure 5.1: A digraph example with its adjacent matrix on R-Mesh

0 1 2

1 2 3

2 0 1

3 1 2

0

1

2 3 4

0 1 2

1 2 3

2 0 1

0

Figure 5.2: All-pairs shortest distance of the example

Theorem 5.3.1 The diameter problem on digraph can be solved in O(log d(D)) time on a 3-Dn×n×n1+non-directional reconfigurable mesh, whered(D) is the diameter of the digraphD.

Proof The proof of this theorem is similar to Theorems 2.2.1, 4.2.1 and 4.2.2, so the detail steps are omitted. The only difference is that the MIN function will be replaced with a constant-time minimum finding algorithm on a 2-D n × n R-Mesh. So the time complexity will be O(log d(D)).

After we got the all-pairs shortest distances, we can use the shortest distances as the labels for vertices. An example is shown in Figure 5.3. The labels of vertices are the order in the topological sort tree. Figure 5.4 shows the result. The users only need to decide which vertex as the source node, output the corresponding result, and make sure the input digraph is a legal digraph for topological sort.

The source node selection usually is quite simple, we can choose the vertex whose in-degree is 0 and its vertex’s index is the minimum as the source node. These steps can be done by the constant-time OR algorithm on a 1-D n processors R-Mesh to find the in-degree of a vertex with 0 and the constant-time MIN algorithm on a 2-D n × n processors R-Mesh to find a vertex with the minimum index. In fact, we also can use the cyclic graph check algorithm proposed in Chapter 3 to make sure whether the digraph is an acyclic digraph or not.

Figure 5.3: All-pairs shortest distances result

Theorem 5.4.1 The topological sort problem on digraph can be solved in O(log d(D)) time on a 3-Dn×n×n1+non-directional reconfigurable mesh, whered(D) is the diameter of the digraphD.

Proof The proof of this theorem is similar to Theorems 2.2.1, 4.2.1 and 4.2.2, so the detail steps are omitted. The only difference is that the MIN function will be replaced with a constant-time minimum finding algorithm on a 2-D n × n R-Mesh. So the time complexity will be O(log d(D)).

5.5 Conclusion

In Chapter 4, we have proposed an all-pairs shortest distance algorithm for digraphs on the non-directional reconfigurable mesh. Some related digraph problems are solved by modifying our all-pairs shortest distance algorithm. All algorithms show us that these digraph problems can have algorithms on the non-directional model. We also found that all-pairs shortest distance, single-source shortest distance, diameters, and topological sort problems are logical equivalent. This result tells us that some digraph problems are logical equivalent, this can simplify the design of algorithms.

From our algorithms, we know that the time complexity of most digraph problems is related to the diameter of digraph D and 1 ≤ d(D) ≤ n. The diameters of most digraphs are less than n, D = (V, A), | V |=n, and | A |=m. In previous researches, algorithms for the dense digraphs usually have higher time complexities than the sparse counterparts.

only related to the diameter of digraph and more arcs will have smaller diameter with higher possibility.

We summarize previous and our results in Table 5.1.

Table 5.1: Summary of previous and our results for Chapter 5.

Problem Previous results Our results

Single-source shortest Distance (Digraph)

On 2-D n2× n2 DR-Mesh, O(1) time, w = 1, Bertossi [13]

3-D n × n × n1+ R-Mesh model, O(log d(D)) time

Single-source shortest path (Digraph)

On 2-D n2w×n2w DR-Mesh, O(1) time, w = maximum arc weight, Bertossi [13]

Diameter On 3-D n × n × n1+ R-Mesh

model, O(log d(D)) time Topological sort On 3-D n×n×n CD-PARBS

model, O(1) time, Kuo [12]

On 3-D n × n × n1+ R-Mesh model, O(log d(D)) time

6.1 Conclusion

In Chapter 1, we describe that there are two categories in reconfigurable architectures, directional and directional. The directional models are more powerful than the non-directional models, since they can control data flow in each segment of a bus. This is why the researchers can develop digraph algorithms on such models. We believe that the di-rectional models are too idealistic. As we know, the power of reconfigurable architectures is the capability of constant-time data broadcasting.

The s-t connectivity algorithm is used in many digraph or graph algorithms. It is a very important algorithm in reconfigurable architectures. By using it, the researchers can get some relations between the specified source node to all other nodes. For example, the reachability is quite easy to get. The digraph or graph is embedded in an n×n directional or non-directional reconfigurable model. A signal is sent from a specified processor (s, s) representing the source vertex s, and the target vertex t is connected to the source vertex s if and only if processor (t, t) receives the signal. But the distance between two specified nodes is still a problem. In [13], we do know that the s-t connectivity algorithm is not a perfect solution. We still need other approaches to solve digraph or graph problems on reconfigurable architectures.

In previous researches, algorithms for the dense digraphs usually have higher time complexities than the sparse counterparts. But in this study, we show that the time com-plexities of some digraph algorithms are only related to the diameter of digraph and more arcs will have smaller diameter with higher possibility.

1. Matrix multiplication based approach - It is a model independent approach and the matrix multiplication algorithm is cost optimal on reconfigurable architectures, which takes O(1) time and uses O(n×n×n) processors.

2. The s-t connectivity based approach - It can solve some digraph problems in O(1) time with reasonable number of processors. In [13], the single-source shortest path algorithm on digraph does use a lot of processors. Although this algorithm is a constant-time algorithm, but the total cost is too high, i.e. 2-D n2w ×n2w proces-sors DR-Mesh. Our single-source shortest distance and all-pairs shortest distance algorithms are the special instances of their single-source shortest path algorithm, but our two algorithms give us some hints to solve single-source shortest path and all-pairs shortest path problems on non-directional model.

3. The transitivity based approach: The transitivity rule is our basic idea in this study.

The key difference between the transitivity based approach and the s-t connectivity based approach is that the transitivity based approach can be used to get the final result and also can collect the intermediate information. That is the most important feature of our approach.

6.2 Future Work

From Table 4.1, we know that the costs of the all-pairs shortest path algorithm of digraph on non-directional model and single-source shortest path algorithm of digraph on direc-tional model are quite high. Although we have designed all-pairs shortest distance and

could not solve the general shortest path problems. In this study, there is still an open question as shown in Figure 6.1 - how to update the shortest directed paths globally on non-directional reconfigurable architectures. In Figure 6.1, the dotted line is the range of the first round we reached and the thick line is the range of the second round we reached.

The upper directed path should be replaced by the lower directed path, because the lower path is shorter for some vertices in the upper directed path. We have to update these infor-mation to obtain the correct result. If we can solve this open question, then most digraph problems with different weights could have algorithms on non-directional reconfigurable architectures.

Figure 6.1: An open question - globally update reachable information

[1] Joseph JaJa, An Introduction to Parallel Algorithms, Addison-Wesley, 1992.

[2] G. Estrin, “Organization of computer systems: the fixed plus variable structure computer,” in Proc. Western Joint Computer Conf. 1960, Western Joint Computer Conference.

[3] G. Estrin, “Reconfigurable computer origins: the ucla fixed-plus-variable (f+v) structure computer,” IEEE Ann. Hist. Comput., vol. 24, pp. 3–9, 2002.

[4] Y. Ben-Asher, D. Peleg, R. Ramaswami, and A. Schuster, “The power of reconfigu-ration,” Lecture Notes in Computer Science, vol. 510, pp. 139–150, 1991.

[5] K. Nakano, “A bibliography of published papers on dynamically reconfigurable architectures,” Parallel Processing Letters, vol. 5, pp. 111–124, 1995.

[6] K. Bondalapati and V. K. Prasanna, “Reconfigurable computing: architectures, mod-els and algorithms,” Current Science, vol. 78, no. 7, pp. 828–837, 2000.

[7] R. Vaidyanathan and J. L. Trahan, Dynamic reconfiguration architectures and algo-rithms, Kluwer, New York, 2004.

[8] R. Wankar and R. Akerkar, “Reconfigurable architectures and algorithms: A re-search survey,” International Journal of Computer Science and Applications, vol. 6, no. 1, pp. 108–123, 2009.

[9] R. Miller, V. K. Prasanna, D. Reisis, and Q. F. Stout, “Meshes with reconfigurable buses,” in Processing of 5th MIT Conference on Advanced Research in VLSI, 1988.

reconfigurable meshes,” IEEE Transactions on Computers, vol. 42, pp. 678–692, 1993.

[11] B. Pradeep and C. S. R. Murthy, “A constant time algorithm for redundancy elimi-nation in task graphs on processor arrays with reconfigurable bus systems,” Parallel Processing Letters, vol. 3, pp. 171–177, 1993.

[12] C. J. Kuo, C. C. Hsu, and W. C. Fang, “Parallel directed graph algorithms on direc-tional processor arrays with reconfigurable bus systems,” New Generation Comput-ing, vol. 17, pp. 175–200, 1999.

[13] A. A. Bertossi and A. Mei, “Constant time dynamic programming on directed re-configurable networks,” IEEE Transaction on Parallel and Distributed Systems, vol.

11, pp. 529–536, 2000.

[14] T. T. Pan and S. S. Lin, “Constant-time algorithms for minimum spanning tree problem and related problems on processor arrays with reconfigurable bus systems,”

Computer Journal, vol. 45, pp. 174–186, 2002.

[15] S. Warshall, “A theorem on boolean matrices,” Journal of ACM, vol. 9, pp. 11–12, 1962.

[16] R. Tarjan, “Depth-first search and linear graph algorithms,” SIAM Journal on Com-puting, vol. 1, pp. 146–160, 1972.

[17] A. Aggarwal, R. J. Anderson, and M. Y. Kao, “Parallel depth-first search in general directed graphs,” SIAM Journal on Computing, vol. 19, pp. 397–409, 1990.

Press and McGraw-Hill, 1 edition, 1990.

[19] B. F. Wang, G. H. Chen, and F. C. Lin, “Constant time sorting on a processor array with reconfigurable bus system,” Information Processing Letters, vol. 34, pp. 187–

192, 1990.

[20] B. F. Wang and G. H. Chen, “Constant time algorithms for transitive closure and some related graph problem on processor arrays with reconfigurable bus systems,”

IEEE Transaction on Parallel Distributed System, vol. 1, pp. 500–507, 1990.

[21] M. Y. Kao and P. N. Klein, “Towards overcoming the transitive-closure bottleneck:

efficient parallel algorithms for planar digraph,” in Proc. of 22nd ACM Symposium on Theory of Computing, 1990.

[22] G. H. Chen, B. F. Wang, and C. J. Lu, “On the parallel computation for the algebraic path problem,” IEEE Transaction on Parallel Distributed Systems, vol. 3, pp. 251–

256, 1992.

[23] Y. Han, V. Pan, , and J. Reif, “Efficient parallel algorithm for computing all pair shortest paths in directed graphs,” in Proc. 4th ACM symp. on Parallel Algorithms and Architectures, 1992.

[24] M. Y. Kao, “Linear-processor nc algorithm for planar directed graphs i: strongly connected components,” SIAM Journal on Computing, vol. 22, pp. 431–459, 1993.

tion,” in Proc. 5th ACM Symp. On Parallel Algorithms and Architectues (SPAA’93), 1993, pp. 57–67.

[26] P. Thangavel and V. P. Muthuswamy, “Parallel algorithms for addition and multipli-cation on processor arrays with reconfigurable bus systems,” Information Processing Letters, vol. 46, pp. 89–94, 1993.

[27] G. H. Chen and B. F. Wang, “Sorting and computing convex hulls on processor arrays with reconfigurable bus systems,” Information Science, vol. 72, pp. 191–206, 1993.

[28] R. Vaidyanathan and J. L. Trahan, “Optimal simulation of multidimensional recon-figurable meshes by two dimensional reconrecon-figurable meshes,” Information Process-ing Letters, vol. 47, pp. 267–273, 1993.

[29] S. S. Lin, “Cost-effective algorithms for processor arrays with reconfigurable bus systems,” Journal of the Chinese Institute of Engineers, vol. 17, no. 2, pp. 279–288, 1994.

[30] M. Nigam and S. Sahni, “Sorting n number on n × n reconfigurable meshes with buses,” Journal of Parallel and Distributed Computing, vol. 23, pp. 37–48, 1994.

[31] Y. C. Chen and W. T. Chen, “Constant time sorting on reconfigurable meshes,” IEEE Transaction on Computers, vol. 43, no. 6, pp. 749–751, 1994.

[32] J. W. Jang and V. K. Prasanna, “An optimal sorting algorithm on reconfigurable mesh,” Journal of Parallel and Distributed Computing, vol. 25, pp. 31–41, 1995.

tree algorithms on reconfigurable meshes on size n × n,” Journal of Parallel and Distributed Computing, vol. 26, pp. 137–150, 1995.

[34] T. Hayashi, K. Nakano, and S. Olariu, “Efficient list ranking on the reconfigurable mesh with applications,” Tech. Rep., Hayashi Laboratory Technical Report TR96-03, 1996.

[35] T. H. Lai and M. J. Sheng, “Constructing euclidean minimum spanning tree and all nearest neighbors on reconfigurable meshes,” IEEE Transaction on Parallel Dis-tributed Systems, vol. 7, pp. 806–817, 1996.

[36] J. L. Trahan, R. Vaidyanathan, and C. P. Subbaraman, “Constant time graph algo-rithms on the reconfigurable multiple bus machine,” Journal of Parallel and Dis-tributed Computing, vol. 46, pp. 1–14, 1997.

[37] H. R. Tsai, S. J. Horng, S. S. Tsai, T. W. Kao, and S. S. Lee, “Solving an algebraic path problem and some related graph problems on a hyper-bus broadcast network,”

IEEE Transaction on Parallel Distributed Systems, vol. 8, pp. 1226–1235, 1997.

[38] H. R. Tsai, S. J. Horng, S. S. Lee, S. S. Tsai, and T. W. Kao, “Parallel hierarchical clustering algorithms on processor arrays with a reconfigurable bus system,” Pattern Recognition, vol. 30, pp. 801–815, 1997.

[39] J. Jang, M. Nigam, V. K. Prasanna, and S. Sahni, “Constant time algorithms for computational geometry on the reconfigurable mesh,” IEEE Transaction on Parallel and Distributed Systems, vol. 8, no. 1, pp. 1–12, 1997.

configurable mesh,” IEEE Transaction on Parallel and Distributed Systems, vol. 8, pp. 521–532, 1997.

[41] B. Dixon and R. E. Tarjan, “Optimal parallel verification of minimum spanning trees in logarithmic time,” Algorithmica, vol. 17, no. 1, pp. 11–18, 1993.

[42] C. H. Wu, S. J. Horng, and H. R. Tsai, “Efficient parallel algorithms for hierarchical clustering on arrays with reconfigurable optical buses,” Journal of Parallel and Distributed Computing, vol. 60, pp. 1137–1153, 2000.

[43] Y. Wan, Y. Xu, X. Gu, and G. Chen, “Efficient minimum spanning tree algorithms on the reconfigurable mesh,” Journal of Computer Science and Technology, vol. 15, pp. 116–125, 2000.

[44] 潘典台, 可重組態匯流排之處理器陣列上之常數時間最小擴張樹演算法, 國立

臺灣師範大學資訊教育研究所碩士論文, 1998.

[45] K. W. Chong, Y. Han, Y. Igarashi, and T. W. Lam, “Improving the efficiency of parallel minimum spanning tree algorithms,” Discrete Applied Mathematics, vol.

126, pp. 33–54, 2003.

[46] W. Schudy, “Finding strongly connected components in parallel using o(log2 n) reachability queries,” in Proceedings of the twentieth annual symposium on Paral-lelism in algorithms and architectures, 2008.

[47] J. H. Reif, “Depth-first search is inherently sequential,” Information Processing Letters, vol. 20, pp. 229–234, 1985.

complexity, MIT Press, Cambridge, MA, USA, 1990.

(A) Journal Papers:

[A1] T. T. Pan and S. S. Lin (2002). Constant-time Algorithms for Minimum Span-ning Tree Problem and Related Problems on Processor Arrays with Reconfig-urable Bus Systems,” Computer Journal, Vol. 45, No.2, pp. 174-186.

[A2] T. T. Pan and S. S. Lin (2011). “The Transitive Closure and Related Algo-rithms of Digraph on the Reconfigurable Architecture,” Parallel Processing Letters, Accepted for publication.

(B) 碩碩碩士士士論論論文文文:::

[B1] 潘典台 (1998), “可重組態匯流排之處理器陣列上之常數時間最小擴張

樹演算法,” 國立臺灣師範大學資訊教育研究所碩士論文。

(C) 準準準備備備投投投稿稿稿之之之期期期刊刊刊論論論文文文:::

[C1] T. T. Pan and S. S. Lin (2011). “The All-Pairs Shortest Distance and Re-lated Algorithms of Digraph on the Reconfigurable Architecture.” submitted to Computer Journal.

Appendix A

本附錄為“Parallel Processing Letters”所接受之

相關文件