A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks

Size: px
Start display at page:

Download "A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks"

Transcription

1 Available online at Procedia Computer Science 9 (2012 ) International Conference on Computational Science, ICCS 2012 A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks Wei Peng 1, Xiaofeng Hu, Feng Zhao, Jinshu Su School of Computer,National University of Defense Technology Changsha, Hunan, , China Abstract Finding shortest paths is a fundamental problem in graph theory, which has a large amount of applications in many areas like computer science, operations research, network routing and network analysis. Although many exact and approximate algorithms have been proposed, it is still a time-consuming task to calculate shortest paths for large-scale networks with tremendous volume of data available in recent years. In this paper, we find that the classic Dijkstra s algorithm can be improved by simple modification. We propose a fast algorithm which utilize the previously-calculated results to accelerate the latter calculation. Simple optimization strategies are also proposed with consideration of characteristics of scale-free complex networks. Our experimental results show that the average running time of our algorithm is lower than the Dijkstra s algorithm by a factor relating to the connection probability in random networks of ER model. The performance of our algorithm is significantly better than the Dijkstra s algorithm in scale-free networks generated by the AB model. The results show that the time complexity is reduced to about O(n 2.4 ) in scalefree complex networks. When the optimization strategies are applied, the algorithm performance is further improved slightly in scale-free networks. Keywords: All-Pairs Shortest-Paths Problem, Complex Network, Algorithm, Time Complexity 1. Introduction Finding shortest paths is a classic problem in graph theory. It has enormous applications in many areas including computer science, operations research, transportation engineering, network routing and network analysis. Due to its great values in both scientific research and engineering tasks, it has been extensively studied in all kinds of classic graphs or networks, directed or undirected, weighted or unweighted. There are algorithms with polynomial time complexities for the shortest path problems. For directed graphs with real edge weights, the best-known algorithm [1] for the all-pairs shortest-path (APSP) problem has the time complexity of O(n 3 / log n). For unweighted undirected graphs, the APSP problem can be solved in O(nm) time [2]. Although these algorithms are efficient, they are still time-consuming when applied on large-scale complex networks. addresses: wpeng@nudt.edu.cn (Wei Peng), xfhu@nudt.edu.cn (Xiaofeng Hu), fengzhao@nudt.edu.cn (Feng Zhao), sjs@nudt.edu.cn (Jinshu Su) 1 Corresponding author Published by Elsevier Ltd. doi: /j.procs Open access under CC BY-NC-ND license.

2 558 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Complex networks have attracted much attention in recent years. It has been found that many systems in real world can be modeled as a large-scale complex network and they can be studied using random graph theory. Such networks include the Internet, electronic grid, transport network, metabolic network and social network. Due to their large-scale feature, it becomes a critical task to study their characteristics by calculating the shortest paths in them. Many approximating shortest-path algorithms have been proposed to meet the requirements of large-scale complex network analysis [3][4]. However, it is still necessary to find the exact shortest-paths in many applications. In this paper, we find that the classic Dijkstra s algorithm [5] can be improved with simple modification. We propose an algorithm for the APSP problem and optimization strategies with consideration of the characteristics of scale-free complex networks. Then the performance of the proposed algorithms is studied by experiments on random networks generated by the Erdös-Rényi (ER) model [6] and the Albert-Barabási (AB) model [7]. With different parameter settings, the experiment results show that the proposed algorithm has better performance than the Dijkstra s algorithm. The results are significantly better when applied on scale-free complex networks. Using regression methods, we find that the time complexity of our algorithm is only about O(n 2.4 ) while the original Dijkstra s algorithm has a time complexity of O(n 3 ) for the APSP problem. The experimental results also show that the performance of the proposed algorithm is slightly improved in scale-free complex networks when the optimization strategies are applied. The rest of the paper is organized as follows. Section II presents a short survey on the related research work. Section III describes the shortest-path algorithms and optimization strategies for scale-free complex networks. The experimental results are presented in section IV. Finally, we conclude the paper in section V. 2. Related Work The shortest-paths problems are classic problems in graph theory and there are many research results toward designing an efficient algorithm to calculate shortest paths in all kinds of networks. Two classic algorithms for the single-source shortest-path (SSSP) problem are the Bellman-Ford algorithm [8] and the Dijkstra s algorithm [5]. They have O(nm) and O(n 2 ) time complexities, respectively, where n is the number of vertices and m is the number of edges in a graph. The Dijkstra s algorithm is used in a network where each edge has a positive length (or weight) value. The Bellman-Ford algorithm can be applied in the situation when edge lengths are negative. For the APSP problem, the Floyd-Warshall algorithm is a classic algorithm which has the time complexity of O(n 3 ). Many algorithms have been proposed by improving or combining the above classic algorithms. For example, based on the Dijkstra s algorithm, Orlin et al. [9] proposed a faster algorithm for the SSSP problem in networks with few distinct positive lengths. Goldberg et al. [10] proposed an efficient shortest path algorithm which combines with A search. Roditty and Zwick [11] studied the dynamic shortest path problems and proposed a randomized fullydynamic algorithm for the APSP problem in directed unweighted graphs. For directed graph with real edge weights, Pettie s algorithm [12] solves the APSP problem in O(nm + n 2 loglogn) time. Chan [1] firstly obtained an algorithm with time complexity O(n 3 / log n) in 2005, which is the best-known result for the APSP problem in a directed graph. Han [13] also proposed an algorithm with the same time complexity later, using a smaller table. To meet the requirements of large-scale complex network analysis, many algorithms have recently been proposed to find the approximating solutions for the shortest-paths problems. Baswana et al. [3] propose a randomized algorithm for computing all-pairs nearly 2-approximate distances with time complexity of O(n 2 log 3/2 n). The approximate distance is bounded by 2δ(u, v) + 3 where δ(u, v) is the shortest-path distance between u and v. Potamias et al. [14] propose a landmark-based method to estimate point-to-point distances in very large networks. Similarly, Tang et al. [4] propose an approximate algorithm for the APSP problem in complex networks. The algorithm first selects some high-degree nodes as local central points and find the approximate shortest-path distances using the pre-calculated shortest-paths starting from these local central points. In contrast to these works, we try to find simple and efficient methods to calculate the exact shortest-path distances in complex networks. 3. New Algorithms for All-Pairs Shortest-Paths Problem 3.1. Basic Algorithm The well-known Dijkstra s algorithm uses a simple breadth-first search approach to find all shortest paths from a single source to all other vertices in a given graph. It has the advantages of efficiency and simplicity. To find all-pairs

3 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Figure 1: Example of covered nodes shortest-paths, we can apply the Dijkstra s algorithm on each vertex iteratively. Such an intuitive approach is simple, but not very efficient. To improve the Dijkstra s algorithm on the APSP problem, we propose a new algorithm that utilizes information obtained in previous steps to accelerate the latter process. Let G = (V, E) denote a weighted directed graph, where V and E are the set of vertices and edges respectively. The edge from the vertex u and v is denoted as (u, v) and its weight is w(u, v). We give the following definition to illustrate the main idea of our algorithm. Definition 1: If the vertex t is an intermediate vertex on the shortest path from the vertex u to v, then we say that v is covered by t. The Dijkstra s algorithm uses a breadth-first search (BFS) method to get shortest paths starting from a single source. When the vertex t is visited in the search process, if the shortest paths from t have been obtained in previous steps, then we can immediately obtain the shortest paths from source s to all other vertices using t as an intermediate vertex. In other words, given a source s, we need not visit other vertices which are covered by t. Based on this idea, we propose the following algorithm which improves the Dijkstra s algorithm on solving the APSP problem. Many vertices may be covered by an intermediate vertex t (see Figure 1 for an example), so the total time used may be reduced dramatically. We use the following data structures in the proposed algorithm: L: the matrix containing the edge weights, where L[u, v] is the weight of edge (u, v). If the edge (u, v) does not exist, then L[u, v] = ; D: the distance matrix, where D[u, v] is the distance from the vertex u to v. Initially, D[u, v] = for all vertex pairs; flag: the vector to indicate whether the shortest paths from a vertex to other vertices have been calculated. All elements of the vector are set to zero initially. After the shortest paths for vertex u are calculated, flag[u] is set to 1. Q: the min-priority queue containing the vertices to be visited. It is the same queue as that used in the classic Dijkstra s algorithm. To find all shortest paths in a graph G, the algorithm firstly initializes the flag vector by setting all elements as zero (step 1-2 in Algorithm 1) and initializes all elements of the distance matrix to be infinity (step 3-4 in Algorithm 1). Then the modified Dijkstra s procedure (Procedure 1) is called iteratively to find shortest paths starting from every vertex. Compared to the classic Dijkstra s algorithm, the steps 5-10 in procedure 1 are main stuff newly added. When a vertex t is visited, if the shortest paths starting from it have been obtained ( flag[t] is set to 1) (step 5 in Procedure 1), then the shortest paths from the source s to other vertices are updated by using t as an intermediate vertex (step 6-10 in Procedure 1). After all shortest paths starting from s have been obtained, we set flag[s] to 1 to indicate it. Other steps are the same as those in the classic Dijkstra s algorithm. The procedure Enqueue(Q, v) adds a vertex v in the min-priority queue Q. The procedure DeQueue(Q) gets a vertex from the queue Q which has the smallest shortest-path starting from s.

4 560 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Procedure 1: Modified Dijkstra s Procedure Input: Graph G = (V, E), source s, weight matrix L, distance matrix D, vector flag Output: updated distance matrix D, updated vector flag 1: D[s, s] = 0 2: Q = {s} 3: while Q is not empty do 4: t=dequeue(q) 5: if flag[t] = 1, then 6: for each vertex v V do 7: if D[s, t] + D[t, v] < D[s, v] then 8: D[s, v]=d[s, t] + D[t, v] 9: end if 10: end for 11: else 12: for each edge (t, v) outgoing from t do 13: if D[s, t] + L[t, v] < D[s, v] then 14: D[s, v]=d[s, t] + L[t, v] 15: Enqueue(Q,v) 16: end if 17: end for 18: end if 19: end while 20: flag[s] = 1 Algorithm 1: Basic Algorithm for the APSP Problem Input: Graph G = (V, E), weight matrix L Output: distance matrix D 1: for each vertex v V do 2: flag[v] = 0 3: for each vertex pair (u,v) do 4: D[u, v] = 5: for each vertex v V do 6: call the modified Dijkstra s procedure to get shortest paths starting from v The following lema ensures the correctness of the algorithm. Lemma 1: If the vertex t is an intermediate vertex on the shortest path from the source s to u, and u is an intermediate vertex on the shortest path from s to v, then the vertex t is also an intermediate vertex on the shortest path from s to v. Proof : Assume the shortest path from s to u is (s,...,t,...,u) and the shortest path from s to v is (s,...,u,...,v). Because sub-paths of a shortest path are also shortest paths, the shortest path from s to v can be obtained by concatenating (s,...,t,...,u) and the sub-path (u,...,v) in the shortest path from s to v. Thus, the vertex t will be in the shortest path from s to v. Theorem 1: Given a graph G = (V, E) and weights of edges, the algorithm 1 finds the shortest paths for all vertex pairs. Proof : We prove that the modified Dijkstra s procedure finds shortest paths starting from a source s. Assume the predecessor of a vertex v on the shortest path from s to v is u. If u is not covered by any vertex which shortest paths have been found, then the shortest path from s to v is obtained by the Dijkstra s BFS procedure (steps 12-17). If u is covered by an intermediate vertex t which shortest paths have been obtained, then t will be an intermediate vertex on the shortest path from s to v, too, according to Lemma 1. Therefore, the shortest path from s to v will be obtained when the vertex t is visited (steps 6-10). Thereby, the modified Dijkstra s procedure will find the shortest path from s to v, and the algorithm 1 will find shortest paths for all vertex pairs. The newly-added steps do not change the upper bound on the time complexity of the algorithm. The proposed algorithm has the same time complexity than the Dijkstra s algorithm. Assume the time complexity of operations on the min-priority queue is δ, then the time complexity of proposed algorithm is O(n(δn + m)). For directed graph with real edge weights, if the queue is implemented simply as an array, then δ=o(n) and the time complexity of the algorithm is O(n 3 + nm) = O(n 3 ). If the queue is implemented with a Fibonacci heap, then δ=o(logn) and the time complexity of the algorithm is O(n 2 logn + nm). For unweighted undirected graph, δ=o(1) and the time complexity of the algorithm is O(n 2 + nm) = O(nm).

5 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Optimization for Complex Networks Complex networks exhibit some interesting features which can be utilized to optimize the procedure of finding shortest paths. Two most important features are called small-world [15] and scale-free [16], respectively. The small-world feature means that nodes in a complex network can be highly clustered, while having small shortest path lengths from each other. The scale-free feature indicates that degrees of vertices in a complex network follow a scalefree power-law distribution. Intuitively, the network is non-uniform and its connectivity is dominated by relatively few high-degree nodes. Since few nodes in a complex network have large number of neighbors (neighboring nodes), it is very possible for these nodes to be in the middle of shortest paths of other nodes. If the shortest paths from these high-degree nodes are obtained in advance, then the visiting of other nodes covered by them can be saved in the modified Dijkstra s procedure. Therefore, the order of vertices to be selected as sources is important for the algorithm performance in the context of complex networks. To determine the order of vertices as sources, one can simply sort the vertices by their degrees. For example, we can sort vertices in descending order and select vertices with high degrees as sources before vertices with low degrees. Because a large number of vertices in a complex network have low degrees, we need not determine the order for all vertices so that the time complexity of the selection process can be reduced. For example, we can use a ratio parameter r (0 < r < 1) to control the selection process. If nr nodes have been selected, then the selection process can be stopped and the vertices which have not been selected will be used as sources in a random order. Based on above ideas, we propose an optimized algorithm for the APSP problem. The following data structures are added: deg: the vector containing the degrees of vertices. deg[i] is the degree of the i-th vertex; order: the vector containing the indices of vertices to be used as sources. order[i] is the index of i-th source vertex. The optimized algorithm is illustrated by Algorithm 2. The steps 5-6 are used to calculate degrees of all vertices and vertices are selected according to their degrees in steps The swap(a, b) operation swaps the values of two variables a and b. Calculating degrees of all vertices requires O(m) time. The selection procedure has the time complexity of O(rn 2 ). Thus, the newly-added steps have the time complexity of O(m + rn 2 ). Algorithm 2: Optimized Algorithm for the APSP Problem Input: Graph G = (V, E), weight matrix L, ratio r Output: distance matrix D 1: for each vertex v V do 2: flag[v] = 0 3: for each vertex pair (u,v) do 4: D[u, v] = 5: for i = 1 to n do 6: Calculate the degree of the i-th vertex 7: for i = 1 to n do 8: order[i] = i 9: for i = 1 to rn do 10: for j = i + 1 to n do 11: if deg[order[ j]] > deg[order[i]] then 12: swap(order[ j], order[i]) 13: for i = 1 to n do 14: call the modified Dijkstra s procedure using the source of index order[i] Algorithm 3: Adaptive Algorithm for the APSP Problem Input: Graph G = (V, E), weight matrix L Output: distance matrix D 1: for each vertex v V do 2: flag[v] = 0 3: for each vertex pair (u,v) do 4: D[u, v] = 5: for i = 1 to n do 6: Calculate the degree of the i-th vertex 7: for i = 1 to n do 8: order[i] = i 9: for i = 1 to n do 10: for j = i + 1 to n do 11: if deg[order[ j]] > deg[order[i]] then 12: swap(order[ j], order[i]) 13: end if 14: end for 15: call the modified Dijkstra s procedure using the source of index order[i]

6 562 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Adaptive Optimization Algorithm In algorithm 2, we use node degrees to determine the order of vertices to be used as sources. Although it is possible for nodes with high degrees to be in the middle of shortest paths of others, we can not guarantee that the optimization in algorithm 2 is always effective. Indeed, a better mechanism is required to improve the algorithm further. An interesting fact is that there are heuristic information in the modified Dijkstra s procedure and those information can be utilized to help selecting sources. In steps of the modified Dijkstra s procedure, if the condition in step 13 is true, then the shortest path from souce s to a vertex v may traverse the edge (t, v) temporarily. It hints at that the vertex t is a possible intermediate vertex on some shortest paths. If the vertex t is used as predecessor more frequently, it will be possible for it to cover more vertices. Thus, it should be used as source in advance. Based on the observations, we propose an improved algorithm which can select sources adaptively. For a vertex t, we use the variable deg[t] to store its priority to be selected as the source. The variable deg[t] is initially set to the degree of t, and later updated in the modified Dijkstra s procedure. If the condition in step 13 of the modified Dijkstra s procedure is true, then we let deg[t] = deg[t] + c (1) where c is a predefined constant, e.g., c = 1. Other steps in the modified Dijkstra s procedure are not changed. The main procedure is stated in Algorithm 3. Since the vector deg changes in the modified Dijkstra s procedure, the algorithm will select vertices as sources adaptively. Calculating degrees of all vertices requires O(m) time. The selection procedure in steps has the time complexity of O(n). Thus, the algorithm 3 has the same time complexity than the algorithm Evaluation of the Algorithms 4.1. Introduction of Experiments We evaluate the performance of the proposed algorithms on random networks. We compare their performance in complex networks with the Erdös and Rényi (ER) random graph model [6] and the scale-free Albert-Barabási (AB) network model [7]. In the ER model, each vertex pair is uniformly connected with a probability p in a network of n nodes. There are about pn(n 1)/2 edges in a ER graph. The average degree of vertices is k = p(n 1) pn. The degrees of vertices can be represented by the Poission distribution. The AB model is an extension of the original Barabási-Albert (BA) model. In the model, a network initially contains m 0 nodes. Then the network grows using the following operations [7]: 1. With probability p, add m new edges. For each edge, one of its end-points is selected randomly from the existing nodes. Another end-point is selected with probability Π(k i ) = k i + 1 (2) j k j + 1 where k i is the degree of the i-th node; 2. With probability q, rewire m edges selected randomly in the network. For each edge, one of its end-points is changed to another node which is selected with a probability given by the Equation (2); 3. With probability 1 p q, add a new node and m new edges connecting the new node to other existing nodes. Another end-point of each new edge is also selected with a probability given by the Equation (2). Depending on the model parameter values, the AB model can not only generate networks with power-law degree distributions, but also networks with exponential degree distributions. When q < 0.5, networks with power-law degree distributions are generated. The model parameter values used in our experiments are given in Table 1. The algorithms to be compared include the classic Dijkstra s algorithm which is called iteratively using every vertex as source, algorithm 1, algorithm 2 and algorithm 3. For each parameter setting, we randomly generate 50 network instances and run the algorithms on them. Then, the running time is averaged on all instances. The test platform is a laptop with Intel Core i7-2640m CPU and 4GB memory, running Fedora 16 (Linux core ) operating system.

7 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Parameter Table 1: Parameter Settings in Experiments Value number of vertices in a network (n) Probability p in the ER model 0.2,0.5,0.8 Parameter m 0 in the AB model 10 Parameter m in the AB model 2 Probability p in the AB model 0.2,0.3,0.8 Probability q in the AB model 0.1,0.2 ratio r in the algorithm constant c in the algorithm p=0.2 p=0.4 p= r (a) ER model p=0.2,q=0.1 p=0.2,q=0.2 p=0.4,q= r (b) AB model Figure 2: Effects of parameter r 4.2. Effects of Algorithm Parameters We test the performance of algorithms on different algorithm parameter values. The node number is set to 1000 for the ER model and 3000 for the AB model. With different values of parameter r, the performance of algorithm 2 is demonstrated in Figure 2. It is shown that the average running time slightly increases with the increasing of r in cases of ER model. It seems that the optimization strategy is not useful in random networks of the ER model. In scale-free networks of the AB model, however, the average running time decreases with increasing of r. The average running time does not change significantly when r > 0.3. Thus, we can use a small value of r in algorithm 2 to improve the algorithm performance in scale-free networks. The performance of algorithm 3 with different values of parameter c is demonstrated in Figure 3. The average running time does not change much in most cases. Therefore, we can assume that the value of c has little impact on the performance of the algorithm Comparison of Algorithm Performance We compare the performance of the classic Dijkstra s algorithm and the algorithm 1 on random networks of ER model and AB model. From Figure 4a, we can see that the average running time increases with the increasing of node number. The algorithm 1 outperforms than the Dijkstra s algorithm in random networks of ER model with different link probability. Both algorithms have the same level of time complexity which is O(n 3 ), but with different factors. Let the time complexity of Dijkstra s algorithm be O(a 0 n 3 ) and the time complexity of algorithm 1 be O(a 1 n 3 ). Using polynomial regression method, we obtain the values of a 0 and a 1 in each case. The results are shown in Table 2. From the table, we can see that the coefficient ratio (a 1 /a 0 ) increases with the increasing of probability p. When p = 0.8, the average running time of the algorithm 1 is about 85% of the time of the Dijkstra s algorithm. When p drops down to 0.2, the

8 564 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) p=0.2 p=0.4 p= p=0.2,q=0.1 p=0.3,q=0.2 p=0.6,q= w (a) ER model w (b) AB model Figure 3: Effects of parameter c Dijkstra (p=0.2) Dijkstra (p=0.5) Dijkstra (p=0.8) Algorithm 1 (p=0.2) Algorithm 1 (p=0.5) Algorithm 1 (p=0.8) node number (a) ER model Dijkstra (p=0.2,q=0.1) Dijkstra (p=0.3,q=0.2) Dijkstra (p=0.8,q=0.1) Algorithm 1 (p=0.2,q=0.1) Algorithm 1 (p=0.3,q=0.2) Algorithm 1 (p=0.8,q=0.1) 10 3 node number (b) AB model Figure 4: Comparison with Dijkstra s Algorithm algorithm 1 takes only about 22% running time of the Dijkstra s algorithm. Thereby, our algorithm is very efficient in cases of sparse random networks. Figure 4b shows the log-log curve of the average running time in scale-free networks of AB model. Interestingly, we find that the performance of algorithm 1 is significantly better than the performance of the Dijkstra s algorithm. The time complexity of algorithm 1 is even reduced in scale-free networks. From figure 4b, we can see that the average running time follows the paw-law distribution for both algorithms. Denote the average running time by y and the node number by n. The relationship between them can be expressed by: log(y) = b 0 + b 1 log(n) (3) where b 0 and b 1 are coefficients. The values of b 0 and b 1 are calculated using the linear regression method and the results are shown in Table 3. It is shown that the time complexity of Dijkstra s algorithm is still O(n 3 ), but the time Table 2: Coefficients on Cases of ER Model Case a 0 a 1 a 1 /a 0 p = p = p =

9 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) Table 3: Coefficients on Cases of AB Model Dijkstra s Algorithm Algorithm 1 Case b 0 b 1 b 0 b 1 p = 0.2, q = p = 0.3, q = p = 0.8, q = average run time (seconds) Algorithm 1 (p=0.5) Algorithm 2 (p=0.5) Algorithm 3 (p=0.5) Algorithm 1 (p=0.8) Algorithm 2 (p=0.8) Algorithm 3 (p=0.8) average run time (seconds) Algorithm 1 (p=0.3,q=0.2) Algorithm 2 (p=0.3,q=0.2) Algorithm 3 (p=0.3,q=0.2) Algorithm 1 (p=0.8,q=0.1) Algorithm 2 (p=0.8,q=0.1) Algorithm 3 (p=0.8,q=0.1) node number (a) ER model node number (b) AB model Figure 5: Comparison of Proposed Algorithms complexity of Algorithm 1 is reduced to about O(n 2.4 ). The performance of three proposed algorithms is compared at last. The results are shown in Figure 5. It can be observed that the average running time of algorithm 2 is slightly higher than other two algorithms in cases of ER model, while the performance of algorithm 3 is comparable to that of algorithm 1. However, in cases of AB model, the average running time of algorithm 2 and the time of algorithm 3 are lower than the time of algorithm 1 when p is low. When p is high, the performance of algorithm 2 is comparable to the performance of algorithm 1 while the performance of algorithm 3 is slightly better than the other two algorithms. 5. Conclusion In this paper, we have studied the all-pairs shortest-paths (APSP) problem. We propose a simple and efficient algorithm by modifying the classic Dijkstra s algorithm for the APSP problem. The idea of the algorithm is simple. That is, we use the shortest-path results calculated in previous steps to help finding the shortest paths in latter steps. Considering the scale-free feature of complex networks, we also proposed optimization strategies to improve the algorithm performance. Experiments are conducted to evaluate the proposed algorithms. The results show that our algorithm is significantly better than the Dijkstra s algorithm in sparse networks and scale-free complex networks. The time complexity is only about O(n 2.4 ) when our algorithm is applied in scale-free networks generated by the AB model. The algorithm performance is slightly improved with the optimization strategies in scale-free networks. Our algorithm is useful in finding exact shortest-path distances in complex networks. It also provides a good base to design more efficient algorithms in the research of complex networks. For example, the algorithm may be modified to calculate the approximate shortest paths and other metrics in complex networks. Acknowledgment This work was supported in part by the National Natural Science Foundation of China under grant No , and , and Hunan Provincial Natural Science Foundation of China under grant No.11JJ7003.

10 566 Wei Peng et al. / Procedia Computer Science 9 ( 2012 ) References [1] T. M. Chan. All-pairs shortest paths with real weights in O(n 3 / log n) time. in: Proc. 9th Workshop Algorithms Data Structures, in: Lecture Notes in Computer Science, vol.3608, Springer, Berlin, 2005, pp [2] T. M. Chan. All-Pairs Shortest Paths for Unweighted Undirected Graphs in o(mn) Time. SODA 06, January 22-26, Miami, FL, [3] S. Baswana, V. Goyal, S. Sen. All-Pairs nearly 2-approximate shortest paths in O(n 2 polylogn) time. Theoretical Computer Science, vol.410, no.1, pp.84-3, [4] J.-T. Tang, T. Wang, and J. Wang. Shortest Path Approximate Algorithm for Complex Network Analysis. Journal of Software, vol.22, no.10, pp , [5] E. W. Dijkstra. A Note on Two Problems in Connexion with Graphs. Numerische Mathematik, vol.1, pp , [6] P. Erdös and A. Rényi. On the Evolution of Random Graphs. Publications of the Mathematical Institute of the Hungarian Academy of Sciences, vol.5, pp.17-61, [7] R. Albert and A.-L. Barabási. Topology of Evolving Networks: Local Events and Universality. Physical Review Letters, vol.85, no.24, Dec [8] R. Bellman. On a Routing Problem. Quarterly of Applied Mathematics, vol.16, no.1, pp.87-90, [9] J. B. Orlin, K. Madduri, K. Subramani, and M. Williamson. A Faster Algorithm for the Single Source Shortest Path Problem with Few Distinct Positive Lengths. Journal of Discrete Algorithms, vol.8, no.2, pp , June [10] A. V. Goldberg, H. Kaplan, and R. F. Werneck. Reach for A*: Efficient Point-to-Point Shortest Path Algorithms. In Proc. of the Eighth Workshop on Algorithm Engineering and Experiments (ALENEX 06), Miami, Florida, USA, pp , Jan [11] L. Roditty and U. Zwick. On Dynamic Shortest Paths Problems. Algorithmica, March 2010 (published online). [12] S. Pettie. A new approach to all-pairs shortest paths on real-weighted graphs. Theoretical Computer Science, vol.312, no.1, pp.47-4, Jan [13] Y. Han. A note of an O(n 3 / log n) time algorithm for all pairs shortest paths. Information Processing Letters, vol.105, no.3, pp , [14] M. Potamias, F. Bonchi, C. Castillo, and A. Gionis. Fast Shortest Path Distance Estimation in Large Networks. Proc. of the 18th ACM Conf. on Information and Knowledge Management (CIKM 2009), Hong Kong, China, pp , Nov [15] D. J. Watts, S. H. Strogatz. Collective dynamics of small-world networks. Nature, vol.393, no.6684, pp , [16] A. L. Barabási, R. Albert. Emergence of scaling in random networks. Science, vol.286, no.5439, pp , [17] T. M. Chan. More algorithms for all-pairs shortest paths in weighted graphs. Proc. of the 39th Annual ACM Symposium on Theory of Computing (STOC 07), San Diego, California, USA, pp , June 2007.

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu CS 267 Lecture 3 Shortest paths, graph diameter Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu Today we will talk about algorithms for finding shortest paths in a graph.

More information

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =

More information

Single Source Shortest Path (SSSP) Problem

Single Source Shortest Path (SSSP) Problem Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,

More information

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time Surender Baswana 1, Vishrut Goyal 2, and Sandeep Sen 3 1 Max-Planck-Institut für Informatik, Saarbrücken, Germany. sbaswana@mpi-sb.mpg.de

More information

Complementary Graph Coloring

Complementary Graph Coloring International Journal of Computer (IJC) ISSN 2307-4523 (Print & Online) Global Society of Scientific Research and Researchers http://ijcjournal.org/ Complementary Graph Coloring Mohamed Al-Ibrahim a*,

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

Distance oracles for unweighted graphs : breaking the quadratic barrier with constant additive error

Distance oracles for unweighted graphs : breaking the quadratic barrier with constant additive error Distance oracles for unweighted graphs : breaking the quadratic barrier with constant additive error Surender Baswana, Akshay Gaur, Sandeep Sen, and Jayant Upadhyay Abstract. Thorup and Zwick, in the seminal

More information

Shortest Path Problem

Shortest Path Problem Shortest Path Problem CLRS Chapters 24.1 3, 24.5, 25.2 Shortest path problem Shortest path problem (and variants) Properties of shortest paths Algorithmic framework Bellman-Ford algorithm Shortest paths

More information

Efficient Algorithms for Solving Shortest Paths on Nearly Acyclic Directed Graphs

Efficient Algorithms for Solving Shortest Paths on Nearly Acyclic Directed Graphs Efficient Algorithms for Solving Shortest Paths on Nearly Acyclic Directed Graphs Shane Saunders Tadao Takaoka Department of Computer Science and Software Engineering, University of Canterbury, Christchurch,

More information

A Study of Different Parallel Implementations of Single Source Shortest Path Algorithms

A Study of Different Parallel Implementations of Single Source Shortest Path Algorithms A Study of Different Parallel Implementations of Single Source Shortest Path s Dhirendra Pratap Singh Department of Computer Science and Engineering Maulana Azad National Institute of Technology, Bhopal

More information

An Evolving Network Model With Local-World Structure

An Evolving Network Model With Local-World Structure The Eighth International Symposium on Operations Research and Its Applications (ISORA 09) Zhangjiajie, China, September 20 22, 2009 Copyright 2009 ORSC & APORC, pp. 47 423 An Evolving Network odel With

More information

Heuristic Algorithms for Multiconstrained Quality-of-Service Routing

Heuristic Algorithms for Multiconstrained Quality-of-Service Routing 244 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL 10, NO 2, APRIL 2002 Heuristic Algorithms for Multiconstrained Quality-of-Service Routing Xin Yuan, Member, IEEE Abstract Multiconstrained quality-of-service

More information

Lesson 4. Random graphs. Sergio Barbarossa. UPC - Barcelona - July 2008

Lesson 4. Random graphs. Sergio Barbarossa. UPC - Barcelona - July 2008 Lesson 4 Random graphs Sergio Barbarossa Graph models 1. Uncorrelated random graph (Erdős, Rényi) N nodes are connected through n edges which are chosen randomly from the possible configurations 2. Binomial

More information

Two-Level Heaps: A New Priority Queue Structure with Applications to the Single Source Shortest Path Problem

Two-Level Heaps: A New Priority Queue Structure with Applications to the Single Source Shortest Path Problem Two-Level Heaps: A New Priority Queue Structure with Applications to the Single Source Shortest Path Problem K. Subramani 1, and Kamesh Madduri 2, 1 LDCSEE, West Virginia University Morgantown, WV 26506,

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no

More information

Two-Levels-Greedy: a generalization of Dijkstra s shortest path algorithm

Two-Levels-Greedy: a generalization of Dijkstra s shortest path algorithm Electronic Notes in Discrete Mathematics 17 (2004) 81 86 www.elsevier.com/locate/endm Two-Levels-Greedy: a generalization of Dijkstra s shortest path algorithm Domenico Cantone 1 Simone Faro 2 Department

More information

Introduction Single-source shortest paths All-pairs shortest paths. Shortest paths in graphs

Introduction Single-source shortest paths All-pairs shortest paths. Shortest paths in graphs Shortest paths in graphs Remarks from previous lectures: Path length in unweighted graph equals to edge count on the path Oriented distance (δ(u, v)) between vertices u, v equals to the length of the shortest

More information

Objective of the present work

Objective of the present work Objective of the present work Optimize Road Network Optimize Airline Network Optimize Rail Network Optimize Computer Network Optimize Social Network Spanners and Emulators For most graph algorithms, the

More information

Single Source Shortest Path

Single Source Shortest Path Single Source Shortest Path A directed graph G = (V, E) and a pair of nodes s, d is given. The edges have a real-valued weight W i. This time we are looking for the weight and the shortest path from s

More information

Applications of Geometric Spanner

Applications of Geometric Spanner Title: Name: Affil./Addr. 1: Affil./Addr. 2: Affil./Addr. 3: Keywords: SumOriWork: Applications of Geometric Spanner Networks Joachim Gudmundsson 1, Giri Narasimhan 2, Michiel Smid 3 School of Information

More information

Title. Ferienakademie im Sarntal Course 2 Distance Problems: Theory and Praxis. Nesrine Damak. Fakultät für Informatik TU München. 20.

Title. Ferienakademie im Sarntal Course 2 Distance Problems: Theory and Praxis. Nesrine Damak. Fakultät für Informatik TU München. 20. Title Ferienakademie im Sarntal Course 2 Distance Problems: Theory and Praxis Nesrine Damak Fakultät für Informatik TU München 20. September 2010 Nesrine Damak: Classical Shortest-Path Algorithms 1/ 35

More information

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review 1 Review 1 Something I did not emphasize enough last time is that during the execution of depth-firstsearch, we construct depth-first-search trees. One graph may have multiple depth-firstsearch trees,

More information

Response Network Emerging from Simple Perturbation

Response Network Emerging from Simple Perturbation Journal of the Korean Physical Society, Vol 44, No 3, March 2004, pp 628 632 Response Network Emerging from Simple Perturbation S-W Son, D-H Kim, Y-Y Ahn and H Jeong Department of Physics, Korea Advanced

More information

from notes written mostly by Dr. Carla Savage: All Rights Reserved

from notes written mostly by Dr. Carla Savage: All Rights Reserved CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among

More information

CSE 502 Class 23. Jeremy Buhler Steve Cole. April BFS solves unweighted shortest path problem. Every edge traversed adds one to path length

CSE 502 Class 23. Jeremy Buhler Steve Cole. April BFS solves unweighted shortest path problem. Every edge traversed adds one to path length CSE 502 Class 23 Jeremy Buhler Steve Cole April 14 2015 1 Weighted Version of Shortest Paths BFS solves unweighted shortest path problem Every edge traversed adds one to path length What if edges have

More information

Solving problems on graph algorithms

Solving problems on graph algorithms Solving problems on graph algorithms Workshop Organized by: ACM Unit, Indian Statistical Institute, Kolkata. Tutorial-3 Date: 06.07.2017 Let G = (V, E) be an undirected graph. For a vertex v V, G {v} is

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 07 Single-Source Shortest Paths (Chapter 24) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/36 Introduction

More information

Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the

Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the Floyd-Warshall algorithm in O(n 3 ) time. Neither of

More information

Last week: Breadth-First Search

Last week: Breadth-First Search 1 Last week: Breadth-First Search Set L i = [] for i=1,,n L 0 = {w}, where w is the start node For i = 0,, n-1: For u in L i : For each v which is a neighbor of u: If v isn t yet visited: - mark v as visited,

More information

An Evolutionary Algorithm for the Multi-objective Shortest Path Problem

An Evolutionary Algorithm for the Multi-objective Shortest Path Problem An Evolutionary Algorithm for the Multi-objective Shortest Path Problem Fangguo He Huan Qi Qiong Fan Institute of Systems Engineering, Huazhong University of Science & Technology, Wuhan 430074, P. R. China

More information

Volume 2, Issue 11, November 2014 International Journal of Advance Research in Computer Science and Management Studies

Volume 2, Issue 11, November 2014 International Journal of Advance Research in Computer Science and Management Studies Volume 2, Issue 11, November 2014 International Journal of Advance Research in Computer Science and Management Studies Research Article / Survey Paper / Case Study Available online at: www.ijarcsms.com

More information

Lecture 11: Analysis of Algorithms (CS ) 1

Lecture 11: Analysis of Algorithms (CS ) 1 Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest

More information

1 Random Graph Models for Networks

1 Random Graph Models for Networks Lecture Notes: Social Networks: Models, Algorithms, and Applications Lecture : Jan 6, 0 Scribes: Geoffrey Fairchild and Jason Fries Random Graph Models for Networks. Graph Modeling A random graph is a

More information

Final Exam Solutions

Final Exam Solutions Introduction to Algorithms December 14, 2010 Massachusetts Institute of Technology 6.006 Fall 2010 Professors Konstantinos Daskalakis and Patrick Jaillet Final Exam Solutions Final Exam Solutions Problem

More information

Chapter 6. Dynamic Programming

Chapter 6. Dynamic Programming Chapter 6 Dynamic Programming CS 573: Algorithms, Fall 203 September 2, 203 6. Maximum Weighted Independent Set in Trees 6..0. Maximum Weight Independent Set Problem Input Graph G = (V, E) and weights

More information

Communication Networks I December 4, 2001 Agenda Graph theory notation Trees Shortest path algorithms Distributed, asynchronous algorithms Page 1

Communication Networks I December 4, 2001 Agenda Graph theory notation Trees Shortest path algorithms Distributed, asynchronous algorithms Page 1 Communication Networks I December, Agenda Graph theory notation Trees Shortest path algorithms Distributed, asynchronous algorithms Page Communication Networks I December, Notation G = (V,E) denotes a

More information

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck Theory of Computing Lecture 7 MAS 714 Hartmut Klauck Shortest paths in weighted graphs We are given a graph G (adjacency list with weights W(u,v)) No edge means W(u,v)=1 We look for shortest paths from

More information

Introduction to Algorithms. Lecture 11

Introduction to Algorithms. Lecture 11 Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest

More information

Shortest Paths. CSE 373 Data Structures Lecture 21

Shortest Paths. CSE 373 Data Structures Lecture 21 Shortest Paths CSE 7 Data Structures Lecture Readings and References Reading Section 9., Section 0.. Some slides based on: CSE 6 by S. Wolfman, 000 //0 Shortest Paths - Lecture Path A path is a list of

More information

CS350: Data Structures Dijkstra s Shortest Path Alg.

CS350: Data Structures Dijkstra s Shortest Path Alg. Dijkstra s Shortest Path Alg. James Moscola Department of Engineering & Computer Science York College of Pennsylvania James Moscola Shortest Path Algorithms Several different shortest path algorithms exist

More information

Properties of Biological Networks

Properties of Biological Networks Properties of Biological Networks presented by: Ola Hamud June 12, 2013 Supervisor: Prof. Ron Pinter Based on: NETWORK BIOLOGY: UNDERSTANDING THE CELL S FUNCTIONAL ORGANIZATION By Albert-László Barabási

More information

Counting the Number of Eulerian Orientations

Counting the Number of Eulerian Orientations Counting the Number of Eulerian Orientations Zhenghui Wang March 16, 011 1 Introduction Consider an undirected Eulerian graph, a graph in which each vertex has even degree. An Eulerian orientation of the

More information

A Partition Method for Graph Isomorphism

A Partition Method for Graph Isomorphism Available online at www.sciencedirect.com Physics Procedia ( ) 6 68 International Conference on Solid State Devices and Materials Science A Partition Method for Graph Isomorphism Lijun Tian, Chaoqun Liu

More information

Comparison of Dijkstra's Algorithm with other proposed algorithms

Comparison of Dijkstra's Algorithm with other proposed algorithms International Academic Institute for Science and Technology International Academic Journal of Science and Engineering Vol. 3, No. 7, 2016, pp. 53-66. ISSN 2454-390X International Academic Journal of Science

More information

Weighted Graph Algorithms Presented by Jason Yuan

Weighted Graph Algorithms Presented by Jason Yuan Weighted Graph Algorithms Presented by Jason Yuan Slides: Zachary Friggstad Programming Club Meeting Weighted Graphs struct Edge { int u, v ; int w e i g h t ; // can be a double } ; Edge ( int uu = 0,

More information

is the Capacitated Minimum Spanning Tree

is the Capacitated Minimum Spanning Tree Dynamic Capacitated Minimum Spanning Trees Raja Jothi and Balaji Raghavachari Department of Computer Science, University of Texas at Dallas Richardson, TX 75083, USA raja, rbk @utdallas.edu Abstract Given

More information

On Reshaping of Clustering Coefficients in Degreebased Topology Generators

On Reshaping of Clustering Coefficients in Degreebased Topology Generators On Reshaping of Clustering Coefficients in Degreebased Topology Generators Xiafeng Li, Derek Leonard, and Dmitri Loguinov Texas A&M University Presented by Derek Leonard Agenda Motivation Statement of

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Algebraic method for Shortest Paths problems

Algebraic method for Shortest Paths problems Lecture 1 (06.03.2013) Author: Jaros law B lasiok Algebraic method for Shortest Paths problems 1 Introduction In the following lecture we will see algebraic algorithms for various shortest-paths problems.

More information

Shortest Paths: Algorithms for standard variants. Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender

Shortest Paths: Algorithms for standard variants. Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender Shortest Paths: Algorithms for standard variants Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender 1 Shortest path problem(s) Undirected single-pair shortest path problem Given

More information

On Performance Evaluation of Reliable Topology Control Algorithms in Mobile Ad Hoc Networks (Invited Paper)

On Performance Evaluation of Reliable Topology Control Algorithms in Mobile Ad Hoc Networks (Invited Paper) On Performance Evaluation of Reliable Topology Control Algorithms in Mobile Ad Hoc Networks (Invited Paper) Ngo Duc Thuan 1,, Hiroki Nishiyama 1, Nirwan Ansari 2,andNeiKato 1 1 Graduate School of Information

More information

Shortest Paths: Basics. Algorithms and Networks 2016/2017 Johan M. M. van Rooij Hans L. Bodlaender

Shortest Paths: Basics. Algorithms and Networks 2016/2017 Johan M. M. van Rooij Hans L. Bodlaender Shortest Paths: Basics Algorithms and Networks 2016/2017 Johan M. M. van Rooij Hans L. Bodlaender 1 Shortest path problem(s) Undirected single-pair shortest path problem Given a graph G=(V,E) and a length

More information

Shortest Path Algorithms

Shortest Path Algorithms Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E

More information

Exercise set #2 (29 pts)

Exercise set #2 (29 pts) (29 pts) The deadline for handing in your solutions is Nov 16th 2015 07:00. Return your solutions (one.pdf le and one.zip le containing Python code) via e- mail to Becs-114.4150@aalto.fi. Additionally,

More information

Overlay (and P2P) Networks

Overlay (and P2P) Networks Overlay (and P2P) Networks Part II Recap (Small World, Erdös Rényi model, Duncan Watts Model) Graph Properties Scale Free Networks Preferential Attachment Evolving Copying Navigation in Small World Samu

More information

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck Theory of Computing Lecture 4/5 MAS 714 Hartmut Klauck How fast can we sort? There are deterministic algorithms that sort in worst case time O(n log n) Do better algorithms exist? Example [Andersson et

More information

A Faster Algorithm for the Single Source Shortest Path Problem with Few Distinct Positive Lengths

A Faster Algorithm for the Single Source Shortest Path Problem with Few Distinct Positive Lengths A Faster Algorithm for the Single Source Shortest Path Problem with Few Distinct Positive Lengths James B. Orlin Sloan School of Management, MIT, Cambridge, MA {jorlin@mit.edu} Kamesh Madduri College of

More information

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456 5.4 Shortest Paths CH08-320201: Algorithms and Data Structures 456 Definitions: Path Consider a directed graph G=(V,E), where each edge e є E is assigned a non-negative weight w: E -> R +. A path is a

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019 CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction

More information

Breadth First Search. Graph Traversal. CSE 2011 Winter Application examples. Two common graph traversal algorithms

Breadth First Search. Graph Traversal. CSE 2011 Winter Application examples. Two common graph traversal algorithms Breadth irst Search CSE Winter Graph raversal Application examples Given a graph representation and a vertex s in the graph ind all paths from s to the other vertices wo common graph traversal algorithms

More information

1 Dijkstra s Algorithm

1 Dijkstra s Algorithm Lecture 11 Dijkstra s Algorithm Scribes: Himanshu Bhandoh (2015), Virginia Williams, and Date: November 1, 2017 Anthony Kim (2016), G. Valiant (2017), M. Wootters (2017) (Adapted from Virginia Williams

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming and data-structures CS/ENGRD 20 SUMMER 208 Lecture 3: Shortest Path http://courses.cs.cornell.edu/cs20/208su Graph Algorithms Search Depth-first search Breadth-first search

More information

Content. 1 Algorithms. 2 Assignment and Knapsack problem 3 Bin Packing. 4 Scheduling

Content. 1 Algorithms. 2 Assignment and Knapsack problem 3 Bin Packing. 4 Scheduling Content 1 Algorithms 2 Assignment and Knapsack problem 3 Bin Packing 4 Scheduling 5 Graph algorithms 5.1 Definitions 5.2 Depth First Search (DFS) and Breadth First Search (BFS) 5.3 Topological Sorting

More information

CSCI 5454 Ramdomized Min Cut

CSCI 5454 Ramdomized Min Cut CSCI 5454 Ramdomized Min Cut Sean Wiese, Ramya Nair April 8, 013 1 Randomized Minimum Cut A classic problem in computer science is finding the minimum cut of an undirected graph. If we are presented with

More information

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007 CS880: Approximations Algorithms Scribe: Chi Man Liu Lecturer: Shuchi Chawla Topic: Local Search: Max-Cut, Facility Location Date: 2/3/2007 In previous lectures we saw how dynamic programming could be

More information

Algorithms for Shortest Paths. course web page: piazza: Learn - for marks. Lecture 1. CS 860 Fall Anna Lubiw, U. Waterloo.

Algorithms for Shortest Paths. course web page: piazza: Learn - for marks. Lecture 1. CS 860 Fall Anna Lubiw, U. Waterloo. CS 860 Fall 2014 Algorithms for Shortest Paths course web page: https://cs.uwaterloo.ca/~alubiw/cs860.html piazza: https://piazza.com/uwaterloo.ca/fall2014/cs860/home Learn - for marks desire path Historical

More information

Online algorithms for clustering problems

Online algorithms for clustering problems University of Szeged Department of Computer Algorithms and Artificial Intelligence Online algorithms for clustering problems Summary of the Ph.D. thesis by Gabriella Divéki Supervisor Dr. Csanád Imreh

More information

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast

More information

An Algorithm and Evaluations of Real Time Shortest Path according to current traffic on road

An Algorithm and Evaluations of Real Time Shortest Path according to current traffic on road P P International Journal of Scientific Engineering and Applied Science (IJSEAS) - Volume-1, Issue-7,October 2015 An Algorithm and Evaluations of Real Time Shortest Path according to current traffic on

More information

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching Henry Lin Division of Computer Science University of California, Berkeley Berkeley, CA 94720 Email: henrylin@eecs.berkeley.edu Abstract

More information

CSCI5070 Advanced Topics in Social Computing

CSCI5070 Advanced Topics in Social Computing CSCI5070 Advanced Topics in Social Computing Irwin King The Chinese University of Hong Kong king@cse.cuhk.edu.hk!! 2012 All Rights Reserved. Outline Graphs Origins Definition Spectral Properties Type of

More information

ARTICLE IN PRESS. JID:JDA AID:300 /FLA [m3g; v 1.81; Prn:3/04/2009; 15:31] P.1 (1-10) Journal of Discrete Algorithms ( )

ARTICLE IN PRESS. JID:JDA AID:300 /FLA [m3g; v 1.81; Prn:3/04/2009; 15:31] P.1 (1-10) Journal of Discrete Algorithms ( ) JID:JDA AID:300 /FLA [m3g; v 1.81; Prn:3/04/2009; 15:31] P.1 (1-10) Journal of Discrete Algorithms ( ) Contents lists available at ScienceDirect Journal of Discrete Algorithms www.elsevier.com/locate/jda

More information

A Multi-Source Label-Correcting Algorithm for the All-Pairs Shortest Paths Problem

A Multi-Source Label-Correcting Algorithm for the All-Pairs Shortest Paths Problem A Multi-Source Label-Correcting Algorithm for the All-Pairs Shortest Paths Problem Hiroki Yanagisawa IBM Research - Tokyo IBM Japan, Ltd. Kanagawa, Japan Email: yanagis@jp.ibm.com Abstract The All-Pairs

More information

Top-k Keyword Search Over Graphs Based On Backward Search

Top-k Keyword Search Over Graphs Based On Backward Search Top-k Keyword Search Over Graphs Based On Backward Search Jia-Hui Zeng, Jiu-Ming Huang, Shu-Qiang Yang 1College of Computer National University of Defense Technology, Changsha, China 2College of Computer

More information

Dijkstra s Shortest Path Algorithm

Dijkstra s Shortest Path Algorithm Dijkstra s Shortest Path Algorithm DPV 4.4, CLRS 24.3 Revised, October 23, 2014 Outline of this Lecture Recalling the BFS solution of the shortest path problem for unweighted (di)graphs. The shortest path

More information

Lecture 6: Shortest distance, Eulerian cycles, Maxflow

Lecture 6: Shortest distance, Eulerian cycles, Maxflow DD2458, Problem Solving and Programming Under Pressure Lecture 6: Shortest distance, Eulerian cycles, Maxflow Date: 2008-10-06 Scribe(s): Adam Kull, David Vuorio Lecturer: Douglas Wikström 1 Shortest path

More information

Workshop In Advanced Data Structures Push-Relabel Heuristics. Maya Orshizer Sagi Hed

Workshop In Advanced Data Structures Push-Relabel Heuristics. Maya Orshizer Sagi Hed Workshop In Advanced Data Structures Push-Relabel Heuristics Maya Orshizer Sagi Hed 1 Contents 1 Overview And Goals 3 2 Our Implementation Of Push Relabel 3 2.1 Definitions...............................

More information

An Algorithm of Parking Planning for Smart Parking System

An Algorithm of Parking Planning for Smart Parking System An Algorithm of Parking Planning for Smart Parking System Xuejian Zhao Wuhan University Hubei, China Email: xuejian zhao@sina.com Kui Zhao Zhejiang University Zhejiang, China Email: zhaokui@zju.edu.cn

More information

Lecture 6 Basic Graph Algorithms

Lecture 6 Basic Graph Algorithms CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 6 Basic Graph Algorithms Uttam Thakore University of Illinois at Urbana-Champaign September 30, 2015 Updates ICPC Regionals teams will be

More information

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast algorithms to solve

More information

Available online at ScienceDirect. Procedia Computer Science 20 (2013 )

Available online at  ScienceDirect. Procedia Computer Science 20 (2013 ) Available online at www.sciencedirect.com ScienceDirect Procedia Computer Science 20 (2013 ) 522 527 Complex Adaptive Systems, Publication 3 Cihan H. Dagli, Editor in Chief Conference Organized by Missouri

More information

Chapter 24. Shortest path problems. Chapter 24. Shortest path problems. 24. Various shortest path problems. Chapter 24. Shortest path problems

Chapter 24. Shortest path problems. Chapter 24. Shortest path problems. 24. Various shortest path problems. Chapter 24. Shortest path problems Chapter 24. Shortest path problems We are given a directed graph G = (V,E) with each directed edge (u,v) E having a weight, also called a length, w(u,v) that may or may not be negative. A shortest path

More information

Detecting negative cycles with Tarjan s breadth-first scanning algorithm

Detecting negative cycles with Tarjan s breadth-first scanning algorithm Detecting negative cycles with Tarjan s breadth-first scanning algorithm Tibor Ásványi asvanyi@inf.elte.hu ELTE Eötvös Loránd University Faculty of Informatics Budapest, Hungary Abstract The Bellman-Ford

More information

Memory Placement in Network Compression: Line and Grid Topologies

Memory Placement in Network Compression: Line and Grid Topologies ISITA212, Honolulu, Hawaii, USA, October 28-31, 212 Memory Placement in Network Compression: Line and Grid Topologies Mohsen Sardari, Ahmad Beirami, Faramarz Fekri School of Electrical and Computer Engineering,

More information

A 2k-Kernelization Algorithm for Vertex Cover Based on Crown Decomposition

A 2k-Kernelization Algorithm for Vertex Cover Based on Crown Decomposition A 2k-Kernelization Algorithm for Vertex Cover Based on Crown Decomposition Wenjun Li a, Binhai Zhu b, a Hunan Provincial Key Laboratory of Intelligent Processing of Big Data on Transportation, Changsha

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Graphs : Shortest Paths Marius Kloft Content of this Lecture Single-Source-Shortest-Paths: Dijkstra s Algorithm Single-Source-Single-Target All-Pairs Shortest Paths Transitive

More information

ALTERNATIVES TO BETWEENNESS CENTRALITY: A MEASURE OF CORRELATION COEFFICIENT

ALTERNATIVES TO BETWEENNESS CENTRALITY: A MEASURE OF CORRELATION COEFFICIENT ALTERNATIVES TO BETWEENNESS CENTRALITY: A MEASURE OF CORRELATION COEFFICIENT Xiaojia He 1 and Natarajan Meghanathan 2 1 University of Georgia, GA, USA, 2 Jackson State University, MS, USA 2 natarajan.meghanathan@jsums.edu

More information

Week 11: Minimum Spanning trees

Week 11: Minimum Spanning trees Week 11: Minimum Spanning trees Agenda: Minimum Spanning Trees Prim s Algorithm Reading: Textbook : 61-7 1 Week 11: Minimum Spanning trees Minimum spanning tree (MST) problem: Input: edge-weighted (simple,

More information

On the Complexity of the Policy Improvement Algorithm. for Markov Decision Processes

On the Complexity of the Policy Improvement Algorithm. for Markov Decision Processes On the Complexity of the Policy Improvement Algorithm for Markov Decision Processes Mary Melekopoglou Anne Condon Computer Sciences Department University of Wisconsin - Madison 0 West Dayton Street Madison,

More information

Classical Shortest-Path Algorithms

Classical Shortest-Path Algorithms DISTANCE PROBLEMS IN NETWORKS - THEORY AND PRACTICE Classical Shortest-Path Algorithms Nesrine Damak October 10, 2010 Abstract In this work, we present four algorithms for the shortest path problem. The

More information

Week 12: Minimum Spanning trees and Shortest Paths

Week 12: Minimum Spanning trees and Shortest Paths Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601

More information

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013. Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for 4540 - Advanced Algorithms, Fall 2013. Today s topic: Karger s min-cut algorithm [3]. Problem Definition

More information

1 Single Source Shortest Path Algorithms

1 Single Source Shortest Path Algorithms 15-850: Advanced Algorithms CMU, Spring 2017 Lecture #4: Shortest Paths and Seidel s Algorithm 2/1/17 Lecturer: Anupam Gupta Scribe: Nicholas Sieger, Adam Kavka In this lecture, we did a review of single

More information

Analysis of Algorithms, I

Analysis of Algorithms, I Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, March 8, 2016 Outline 1 Recap Single-source shortest paths in graphs with real edge weights:

More information

CS261: Problem Set #1

CS261: Problem Set #1 CS261: Problem Set #1 Due by 11:59 PM on Tuesday, April 21, 2015 Instructions: (1) Form a group of 1-3 students. You should turn in only one write-up for your entire group. (2) Turn in your solutions by

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15 600.363 Introduction to Algorithms / 600.463 Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15 14.1 Introduction Today we re going to talk about algorithms for computing shortest

More information

Breadth-First Search, 1. Slides for CIS 675 DPV Chapter 4. Breadth-First Search, 3. Breadth-First Search, 2

Breadth-First Search, 1. Slides for CIS 675 DPV Chapter 4. Breadth-First Search, 3. Breadth-First Search, 2 Breadth-First Search, Slides for CIS DPV Chapter Jim Royer EECS October, 00 Definition In an undirected graph, the distance between two vertices is the length of the shortest path between them. (If there

More information

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u].

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u]. Tutorial Question 1 A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first tree can also be used to classify the edges reachable from the source

More information

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Dijkstra s algorithm for shortest paths when no edges have negative weight. Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm

More information