## Thursday, December 5, 2019

### Algorithms and Advanced Data Structures

Question: Discuss about the Algorithms and Advanced Data Structures. Answer: Introduction The purpose of this report is to introduce a primary aspect of Dijkstras and prims algorithms to calculate the total wire length and clock distance of all nodes from the root of a spanning tree. This report includes a short description of the data structure, program design, and its implementation. Here the programmer calculates the complexity of the develop the application. After calculating the complexity its compare with the expected complexity value of both algorithms. Data structure design In this application, the programmer uses an array to store the weight of all vertex. Here a multidimensional array is used to store the value in the order of a matrix format. This array contains a data type of integer, which indicate that this array is used to store numeric data. In this application, the programmer uses a user, define method to generate the deferent kind of spanning tree. These spanning trees are nodes same, but the weight of each vertex is randomly generated by the math function in this method. These values are stored one by one, and the self-distance of each node is assign with zero. In this multidimensional array, the first index value represents the number of rows and the second index represents the column value. Program design In this application, the programmer uses Dij1kstras and prims algorithm for calculating the total wire length and clock distance in a spanning tree. However, the programmer implements an algorithm, which includes these algorithms and a randomly generated spanning tree. In this design, the programmer set all value or Wight of all edges of a spanning tree by calling a mathematical method. This method will provide all weights of the spanning tree. After that, these algorithms are operated by a single value of Alfa. Implementation In this implementation phase the programmer, implement both algorithms in two different methods. Initially, a random spanning tree is created by a user define method. In this method the programmer set an order of a matrix, this matrix includes the weight of each vertex. To store the values of this matrix, the programmer uses a two-dimensional array. After successfully create a spanning tree, this matrix is delivered to the method DIKSTRA ( ). This method extracts these values and calculates the shortest path. In this method an integer array DIST [] is use to keep the shortest path and another Boolean array SPTSET [] is use to confirm if the vertex n is included in the shortest path list. Now to calculate the MST the programmer use a greedy algorithm called prims algorithm. Here the programmer uses a method to calculate the minimum spanning tree. In this method the programmer use three different arrays to store the constructed MST, key value uses to pull the minimum weight edge in cut and a set of vertices not yet included in MST. In this algorithm, the parent array contains the constructed MST. Test Result Spanning Tree: Step value 0.1 Vertex Total edge length 0 0 1 88 2 18 3 81 Spanning Tree: Step value 0.2 Edge Clock Distance 0 - 1 39 0 - 2 29 1 - 3 51 Spanning Tree: Step value 0.3 Vertex Total edge length 0 0 1 42 2 3 3 15 Spanning Tree: Step value 0.4 Edge Clock Distance 3 - 1 34 0 - 2 58 0 - 3 27 Spanning Tree: Step value 0.5 Vertex Total edge length 0 0 1 1 2 7 3 48 Spanning Tree: Step value 0.6 Edge Clock Distance 2 - 1 89 3 - 2 24 0 - 3 21 Spanning Tree: Step value 0.7 Vertex Total edge length 0 0 1 20 2 32 3 57 Spanning Tree: Step value 0.8 Edge Clock Distance 2 - 1 39 0 - 2 23 2 - 3 39 Spanning Tree: Step value 0.9 Vertex Total edge length 0 0 1 6 2 53 3 76 Spanning Tree: Step value 0.10 Edge Clock Distance 0 - 1 85 0 - 2 6 0 - 3 22 Spanning Tree: Step value 0.11 Vertex Total edge length 0 0 1 74 2 77 3 33 Comparison of Time Complexities The time complexity of the Dijkstras algorithm is O (V^2). However, the help of binary heap it can be reduce. If the programmer uses the binary heap, then it can be reduced up to O (E log V). In the case of Prims algorithm, the calculated time complexity is O (V^2), whereas it can be reduced by the help of binary heap where the graph is represented using the adjacency list. If so, the time complexity is same as Dijkstras algorithm. Conclusion This report of programming with two algorithms simultaneously calculate the total wire length and clock distance of a spanning tree by changing the value of Alfa. In this report, the programmer included the test result of this application. However, the program calculates the total clock distance and wire length from the root. Now from this result, it can be concluded that the program works perfectly. In this process, the programmer also includes the technology works behind this operation. Here two type of program generate two different time complexity. However, the difference between both time complexities of those algorithms is very short. After computing the both time complexity and compare with the expected result, this report represents the success of evidence of this application. Bibliography Abraham, I., Delling, D., Fiat, A., Goldberg, A.V. and Werneck, R.F., 2013. Highway dimension and provably efficient shortest path algorithms. Microsoft Research, USA, Tech. Rep, 9. Chan, T.M., 2012. All-pairs shortest paths for unweighted undirected graphs in o (mn) time. ACM Transactions on Algorithms (TALG), 8(4), p.34. Delling, D., Goldberg, A.V., Nowatzyk, A. and Werneck, R.F., 2013. Phast: Hardware-accelerated shortest path trees. Journal of Parallel and Distributed Computing, 73(7), pp.940-952. Gao, J., Zhao, Q., Ren, W., Swami, A., Ramanathan, R. and Bar-Noy, A., 2015. Dynamic shortest path algorithms for hypergraphs. IEEE/ACM Transactions on Networking, 23(6), pp.1805-1817. Mehlhorn, K., 2013. Data structures and algorithms 1: Sorting and searching (Vol. 1). Springer Science Business Media. Muja, M. and Lowe, D.G., 2014. Scalable nearest neighbor algorithms for high dimensional data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(11), pp.2227-2240. Nanongkai, D., 2014, May. Distributed approximation algorithms for weighted shortest paths. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (pp. 565-573). ACM. Neumann, F. and Witt, C., 2013, July. Bioinspired computation in combinatorial optimization: algorithms and their computational complexity. In Proceedings of the 15th annual conference companion on Genetic and evolutionary computation (pp. 567-590). ACM. Peres, Y., Sotnikov, D., Sudakov, B. and Zwick, U., 2013. All-pairs shortest paths in O (n 2) time with high probability. Journal of the ACM (JACM), 60(4), p.26. Stamatakis, A., 2014. RAxML version 8: a tool for phylogenetic analysis and post-analysis of large phylogenies. Bioinformatics, 30(9), pp.1312-1313. Tewarie, P., Van Dellen, E., Hillebrand, A. and Stam, C.J., 2015. The minimum spanning tree: an unbiased method for brain network analysis. Neuroimage, 104, pp.177-188. Williams, R., 2014, May. Faster all-pairs shortest paths via circuit complexity. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (pp. 664-673). ACM. Zhong, C., Malinen, M., Miao, D. and Frnti, P., 2015. A fast minimum spanning tree algorithm based on k-means. Information Sciences, 295, pp.1-17.