Distributed Single-Source Shortest Path with Only Local Relaxation
Abstract
:1. Introduction
- Our Solution. In this paper, we propose an efficient distributed SSSP algorithm by replacing global relaxation with local relaxation, LR-SSSP. In LR-SSSP, if a vertex and its outgoing neighbor are not in the same computer, we locally create a replica of the neighbor, then the shortest distance of the neighbor’s replica can be updated locally (local relaxation).
- We propose an efficient distributed SSSP algorithm, LR-SSSP, which reduces communication by only performing local edge relaxation.
- We further propose lazy synchronization and forward relaxation to prevent invalid synchronization and computation.
- We provide theoretical analysis to prove the effectiveness and correctness of our proposed LR-SSSP.
- We perform extensive experiments to evaluate LR-SSSP. It is shown that our LR-SSSP can achieve about 6–20× faster speed than existing distributed SSSP algorithms.
2. Preliminaries
2.1. Basic Definition
- Path and its length. A path from to in G, , is composed of a sequence of vertices and their edges . The distance of the is defined as the sum of the length of edges in path , i.e., .
- Single-Source Shortest Path, SSSP. Given a source vertex , single-source shortest path computation is used to find the path from s to any other vertex with minimal length , i.e., the length of any path from s to v, is larger than that of , .
- Edge relaxation. The solution to solve the SSSP problem is edge relaxation. Given edge , the edge relaxation is defined as follows:
- Distributed SSSP. In general, the real graphs are too large to store in a standalone machine. Thus, the big graph is partitioned and stored on a cluster of machines. Let be a partition of the big graph G, where is the set of vertices in and is the set of edges whose source vertices in . For the given source vertex , we aim to find the shortest path , where s and v may be on different machines.
2.2. Related Work
- Memory-Based. The most famous sequential memory-based SSSP algorithm is Dijkstra’s algorithm [7]. It can be performed in time, where n is the number of vertices and m is the number of edges, by employing the priority queue implemented with heap or tree. In the beginning, all the vertices are set to nonconvergent and push source vertex s into the priority queue. Then Dijkstra’s algorithm processes vertices iteratively. In each iteration, Dijkstra’s algorithm selects the nonconvergent vertex v with minimum distance (the first element in the priority queue) and sets it as a convergent vertex. Then v’s outgoing edges are relaxed and its outgoing neighbors’ distances are updated. Meanwhile, v’s outgoing neighbors will be inserted into the priority queue if they are not in the queue. Iteration is repeated until all vertices are set as convergent. Since Dijkstra’s algorithm requires loading the whole graph into memory, Dijkstra’s algorithm is poorly suited for large graphs. There are also some more efficient memory-based SSSP algorithms [17,18,19,20,21] that are accelerated by building indexes in advance. However, these algorithms require the entire graph when building and using indexes, so it is difficult to apply them in distributed SSSP.
- Disk-Based. In order to process large graphs, some disk-based SSSP algorithms are proposed [8,9,22,23]. Disk-based SSSP algorithms focus on designing an effective index to reduce the inefficient edge relaxation or disk I/O. Ref. [22] was the first work to design a disk-based Dijkstra’s algorithm. They tried to reduce disk I/O by replacing the priority queue with the tournament tree. Ref. [23] proposed an efficient index, VC-Index, which can be treated as multiple reduced versions of the graph. Each reduced graph contains some important vertices and the distances between them. Then the SSSP can be accelerated based on precomputed distances. Ref. [8] introduced a tunable hash index to reduce the scale of wasteful data loaded from the disk. Then they proposed a new iterative mechanism and designed an Across-step Message Pruning (ASMP) policy to deal with the disk I/O. Ref. [9] presented HoD index. HoD augments the input graph with a set of auxiliary edges and exploits them to reduce disk I/O.
- Distributed. The traditional Bellman–Ford algorithm can be executed on a distributed cluster. Different from Dijkstra’s algorithm, in each iteration, the Bellman–Ford algorithm selects all the vertices whose distances are changed in the previous iteration to relax their outgoing edges and update their outgoing neighbors. The computation and communication costs are huge due to a large number of invalid relaxations. Preferring selecting the vertices with shorter distances and relaxing their outgoing edges can effectively reduce ineffective relaxation [7]. For example, Dijkstra’s algorithm uses a priority queue to select the vertex with the shortest distance and relaxes its outgoing edges.
3. LR-SSSP
3.1. From Global Relaxation to Local Relaxation
- Global and Local relaxation. In distributed SSSP, if two vertices of an edge are on different computers, then the shortest distance information will be sent through the network. We call this edge relaxation global relaxation, e.g., relaxation on edge in Figure 3. If the edges’ two vertices are in the same computer, the relaxation on them is called local relaxation, e.g., the relaxation on edge in Figure 3.
3.2. Lazy Synchronization
3.3. Forward Relaxation
3.4. Algorithm Detail
Algorithm 1: LR-SSSP () |
Algorithm 2: LazySync () |
Algorithm 3: LocalRelax (v, u, , , , ) |
4. Experimental Evaluation
4.1. Preparation
- Datasets. We evaluate our LR-SSSP with eight datasets, including four real graphs, WiKi, HollyWood, LiveJournal, Orkut, and four synthetic graphs, Graph500-x, where x is 19–22. The real graphs are from SNAP of Standford [15], and Graph500-x are from GraphChallenge of MIT [24]. The detailed information of these datasets is shown in Table 1.
- Experimental cluster. Our experiments are conducted both on local cluster and AliCloud. Our local cluster consists of four machines, and each machine runs Ubuntu 18.04 LTS and is equipped with Intel I5 4590 3.3 GHz CPU, 8 GB memory, and 1000 Mbps network card. The AliCloud cluster consists of 16 ecs.sn2.medium instances.
4.2. Performance of LR-SSSP on Different Datasets
4.3. Scaling Performance
4.4. Pruning Strategies Effectiveness
4.5. Parameter Studies
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Dantzig, G.B. On the shortest route through a network. Manag. Sci. 1960, 6, 187–190. [Google Scholar] [CrossRef]
- Sanders, P. Fast Route Planning; Technical Report. Available online: https://www.youtube.com/watch?v=-0ErpE8tQbw (accessed on 20 May 2023).
- Bader, D.A.; Kintali, S.; Madduri, K.; Mihail, M. Approximating betweenness centrality. In Algorithms and Models for the Web-Graph, Processings of the 5th International Workshop, WAW 2007, San Diego, CA, USA, 11–12 December 2007; Proceedings 5; Springer: Berlin/Heidelberg, Germany, 2007; pp. 124–137. [Google Scholar]
- Li, B.; Su, P.; Chabbi, M.; Jiao, S.; Liu, X. DJXPerf: Identifying memory inefficiencies via object-centric profiling for Java. In Proceedings of the 21st ACM/IEEE International Symposium on Code Generation and Optimization, Montréal, QC, Canada, 25 February–1 March 2023; pp. 81–94. [Google Scholar]
- Bellman, R. On a routing problem. Q. Appl. Math. 1958, 16, 87–90. [Google Scholar] [CrossRef]
- Ford, L.R., Jr. Network Flow Theory; Technical Report; RAND Corp.: Santa Monica, CA, USA, 1956. [Google Scholar]
- Dijkstra, E.W. A note on two problems in connexion with graphs. Numer. Math. 1959, 1, 269–271. [Google Scholar] [CrossRef]
- Wang, Z.; Gu, Y.; Zimmermann, R.; Yu, G. Shortest Path Computation over Disk-Resident Large Graphs Based on Extended Bulk Synchronous Parallel Methods. In Database Systems for Advanced Applications, Processings of the 18th International Conference, DASFAA 2013, Wuhan, China, 22–25 April 2013; Proceedings, Part II 18; Springer: Berlin/Heidelberg, Germany, 2013; pp. 1–15. [Google Scholar]
- Zhu, A.D.; Xiao, X.; Wang, S.; Lin, W. Efficient single-source shortest path and distance queries on large graphs. In Proceedings of the 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Chicago, IL, USA, 11–14 August 2013; pp. 998–1006. [Google Scholar]
- Meyer, U.; Sanders, P. Δ-stepping: A parallelizable shortest path algorithm. J. Algorithms 2003, 49, 114–152. [Google Scholar] [CrossRef]
- Chakaravarthy, V.T.; Checconi, F.; Murali, P.; Petrini, F.; Sabharwal, Y. Scalable single source shortest path algorithms for massively parallel systems. IEEE Trans. Parallel Distrib. Syst. 2016, 28, 2031–2045. [Google Scholar] [CrossRef]
- Teng, F.; Ban, Z.; Li, T.; Sun, Q.; Li, Y. A Privacy-Preserving Distributed Economic Dispatch Method for Integrated Port Microgrid and Computing Power Network. IEEE Trans. Ind. Inform. 2024. [Google Scholar] [CrossRef]
- Lee, K.; Lam, M.; Pedarsani, R.; Papailiopoulos, D.; Ramchandran, K. Speeding up distributed machine learning using codes. IEEE Trans. Inf. Theory 2017, 64, 1514–1529. [Google Scholar] [CrossRef]
- Wu, X.; Zhang, J.; Wang, F.Y. Stability-based generalization analysis of distributed learning algorithms for big data. IEEE Trans. Neural Netw. Learn. Syst. 2019, 31, 801–812. [Google Scholar] [CrossRef] [PubMed]
- Available online: https://snap.stanford.edu/data/ (accessed on 20 May 2023).
- Gong, S.; Zhang, Y.; Yu, G. HBP: Hotness balanced partition for prioritized iterative graph computations. In Proceedings of the 2020 IEEE 36th International Conference on Data Engineering, Dallas, TX, USA, 20–24 April 2020; pp. 1942–1945. [Google Scholar]
- Delling, D.; Sanders, P.; Schultes, D.; Wagner, D. Engineering Route Planning Algorithms. In Algorithmics of Large and Complex Networks: Design, Analysis, and Simulation; Springer: Berlin/Heidelberg, Germany, 2009; pp. 117–139. [Google Scholar]
- Sommer, C. Shortest-path queries in static networks. ACM Comput. Surv. 2014, 46, 1–31. [Google Scholar] [CrossRef]
- Zhu, A.D.; Ma, H.; Xiao, X.; Luo, S.; Tang, Y.; Zhou, S. Shortest path and distance queries on road networks: Towards bridging theory and practice. In Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data, New York, NY, USA, 22–27 June 2013; pp. 857–868. [Google Scholar]
- Ouyang, D.; Qin, L.; Chang, L.; Lin, X.; Zhang, Y.; Zhu, Q. When hierarchy meets 2-hop-labeling: Efficient shortest distance queries on road networks. In Proceedings of the 2018 International Conference on Management of Data, Houston, TX, USA, 10–15 June 2018; pp. 709–724. [Google Scholar]
- Li, Y.; U, L.H.; Yiu, M.L.; Kou, N.M. An experimental study on hub labeling based shortest path algorithms. Proc. VLDB Endow. 2017, 11, 445–457. [Google Scholar] [CrossRef]
- Kumar, V.; Schwabe, E.J. Improved algorithms and data structures for solving graph problems in external memory. In Proceedings of the SPDP’96: 8th IEEE Symposium on Parallel and Distributed Processing, New Orleans, LA, USA, 23–26 October 1996; pp. 169–176. [Google Scholar]
- Cheng, J.; Ke, Y.; Chu, S.; Cheng, C. Efficient processing of distance queries in large graphs: A vertex cover approach. In Proceedings of the 2012 ACM SIGMOD International Conference on Management of Data, Scottsdale, AZ, USA, 20–24 May 2012; pp. 457–468. [Google Scholar]
- Available online: https://graphchallenge.mit.edu/data-sets (accessed on 20 May 2023).
Graph | Abbrv. | # of Vertices | # of Edges | Avg. Degree |
---|---|---|---|---|
WiKi | WK | 4,206,785 | 101,500,998 | 24 |
HollyWood | HW | 1,139,905 | 116,050,145 | 101 |
LiveJournal | LJ | 5,363,260 | 87,681,082 | 16 |
Orkut | OK | 3,072,441 | 117,185,083 | 38 |
Graph500-19 | × | 335,318 | 15,458,507 | 46 |
Graph500-20 | × | 645,820 | 31,361,098 | 48 |
Graph500-21 | × | 1,243,072 | 63,462,385 | 51 |
Graph500-22 | × | 2,393,285 | 128,192,964 | 53 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Tang, J.; Gong, S.; Zhang, Y.; Fu, C.; Yu, G. Distributed Single-Source Shortest Path with Only Local Relaxation. Electronics 2024, 13, 2502. https://doi.org/10.3390/electronics13132502
Tang J, Gong S, Zhang Y, Fu C, Yu G. Distributed Single-Source Shortest Path with Only Local Relaxation. Electronics. 2024; 13(13):2502. https://doi.org/10.3390/electronics13132502
Chicago/Turabian StyleTang, Jianing, Shufeng Gong, Yanfeng Zhang, Chong Fu, and Ge Yu. 2024. "Distributed Single-Source Shortest Path with Only Local Relaxation" Electronics 13, no. 13: 2502. https://doi.org/10.3390/electronics13132502
APA StyleTang, J., Gong, S., Zhang, Y., Fu, C., & Yu, G. (2024). Distributed Single-Source Shortest Path with Only Local Relaxation. Electronics, 13(13), 2502. https://doi.org/10.3390/electronics13132502