DeepAI

# New and Simplified Distributed Algorithms for Weighted All Pairs Shortest Paths

We consider the problem of computing all pairs shortest paths (APSP) and shortest paths for k sources in a weighted graph in the distributed CONGEST model. For graphs with non-negative integer edge weights (including zero weights) we build on a recent pipelined algorithm to obtain Õ(λ^1/4· n^5/4) in graphs with non-negative integer edge-weight at most λ, and Õ(n ·^1/3) rounds for shortest path distances at most . Additionally, we simplify some of the procedures in the earlier APSP algorithms for non-negative edge weights in [HNS17,ARKP18]. We also present results for computing h-hop shortest paths and shortest paths from k given sources. In other results, we present a randomized exact APSP algorithm for graphs with arbitrary edge weights that runs in Õ(n^4/3) rounds w.h.p. in n, which improves the previous best Õ(n^3/2) bound, which is deterministic. We also present an Õ(n/ϵ^2)-round deterministic (1+ϵ) approximation algorithm for graphs with non-negative poly(n) integer weights (including zero edge-weights), improving results in [Nanongkai14,LP15] that hold only for positive integer weights.

• 7 publications
• 7 publications
10/24/2018

### Faster approximation algorithms for computing shortest cycles on weighted graphs

Given an n-vertex m-edge graph G with non negative edge-weights, the gir...
09/04/2021

### Improving The Floyd-Warshall All Pairs Shortest Paths Algorithm

The Floyd-Warshall algorithm is the most popular algorithm for determini...
07/23/2018

### A Faster Deterministic Distributed Algorithm for Weighted APSP Through Pipelining

We present a new approach to computing all pairs shortest paths (APSP) i...
05/19/2020

### Faster Deterministic All Pairs Shortest Paths in Congest Model

We present a new deterministic algorithm for distributed weighted all pa...
02/12/2019

### Partial and Conditional Expectations in Markov Decision Processes with Integer Weights

The paper addresses two variants of the stochastic shortest path problem...
03/07/2022

### Negative-Weight Single-Source Shortest Paths in Near-linear Time

We present a randomized algorithm that computes single-source shortest p...
04/30/2018

### The idemetric property: when most distances are (almost) the same

We introduce the idemetric property, which formalises the idea that most...

## 1 Introduction

Designing distributed algorithms for various network and graph problems such as shortest paths [2, 8, 12, 14, 10] is a extensively studied area of research. The Congest model (described in Sec 1.2) is a widely-used model for these algorithms, see [2, 5, 8, 12]. In this paper we consider distributed algorithms for the computing all pairs shortest paths (APSP) and related problems in a graph with non-negative edge weights in the Congest model.

In sequential computation, shortest paths can be computed much faster in graphs with non-negative edge-weights (including zero weights) using the classic Dijkstra’s algorithm [4] than in graphs with negative edge weights. Additionally, negative edge-weights raise the possibility of negative weight cycles in the graph, which usually do not occur in practice, and hence are not modeled by real-world weighted graphs. Thus, in the distributed setting, it is of importance to design fast shortest path algorithms that can handle non-negative edge-weights, including edges of weight zero.

The presence of zero weight edges creates challenges in the design of distributed algorithms as observed in [8]. (We review related work in Section 1.3.) One approach used for positive integer edge weights is to replace an edge of weight with unweighted edges and then run an unweighted APSP algorithm such as [12, 14] on this modified graph. This approach is used in approximate APSP algorithms [13, 11]. However such an approach fails when zero weight edges may be present. There are a few known algorithms that can handle zero weights, such as the -round randomized APSP algorithm of Huang et al. [8] (for polynomially bounded non-negative integer edge weights) and the -round deterministic APSP algorithm of Agarwal et al. [2] (for graphs with arbitrary edge weights including zero weights). A deterministic pipelined algorithm for this problem that runs in at most was recently given in [1], where is an upper bound on the shortest path length.

### 1.1 Our Results

We present several new results for computing APSP and related problems on an -node graph with non-negative edge weights , including deterministic distributed sub--round algorithms for moderate weights (including zero weights) [1]. All of our results hold for both directed and undirected graphs and we will assume w.l.o.g. that is directed.

Many of our results build on a recent deterministic distributed pipelined algorithm we developed for APSP and -SSP for graphs with non-negative integer weights (including zero weights) [1]. This algorithm computes the -hop shortest path problem for sources (-SSP), with an additional constraint that the shortest paths have distance at most in , together with the corresponding shortest path trees, defined as follows.

###### Definition 1.1.

An -hop shortest path from to in is a path from to of minimum weight among all paths with at most edges (or hops).
An -SSP tree for source and shortest path distance is a tree rooted at that contains an -hop shortest path from to every other vertex to which there exists an -hop path with weight at most in . In the case of multiple -hop shortest paths from to a vertex , this tree contains the path with the smallest number of hops, breaking any further ties by choosing the predecessor vertex with smallest ID.

The pipelined algorithm achieves the bounds in the following theorem.

###### Theorem 1.2.

[1] Let be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers (with zero-weight edges allowed). The following deterministic bounds can be obtained in the Congest model for shortest path distances at most .
(i) -SSP in rounds.
(ii) APSP in rounds.
(iii) -SSP in rounds.

The new results we present in this paper are the following.

1. Faster Deterministic APSP for Non-negative, Moderate Integer Weights. We improve on the bounds given in and of Theorem 1.2 by combining the pipelined algorithm in [1] with a modified version of the APSP algorithm in [2] to obtain our improved Algorithm 1, with the bounds stated in the following Theorems 1.3 and 1.4. To obtain these improved bounds we also present an improved deterministic distributed algorithm to find a ‘blocker set’ [2].

###### Theorem 1.3.

Let be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers bounded by (with zero-weight edges allowed). The following deterministic bounds can be obtained in the Congest model.
(i) APSP in rounds.
(ii) -SSP in rounds.

###### Theorem 1.4.

Let be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers (with zero edge-weights allowed), and the shortest path distances are bounded by . The following deterministic bounds can be obtained in the Congest model.
(i) APSP in rounds.
(ii) -SSP in rounds.

Our results in Theorem 1.3 and 1.4 improve on the deterministic APSP bound of Agarwal et al. [2] for significant ranges of values for both and , as stated below.

###### Corollary 1.5.

Let be a directed or undirected edge-weighted graph with non-negative edge weights (and zero-weight edges allowed). The following deterministic bounds hold for the Congest model for .
(i) If the edge weights are bounded by , then APSP can be computed in rounds.
(ii) For shortest path distances bounded by , APSP can be computed in rounds.

The corresponding bounds for the weighted -SSP problem are: (when ) and (when ). Note that the result in is independent of the value of (depends only on ) and the result in is independent of the value of (depends only on ).

2. Simplifications to Earlier Algorithms. Our techniques give simpler methods for some of procedures in the two previous distributed weighted APSP algorithms that handle zero weight edges. In Section 3 we present simple deterministic algorithms that match the congest and dilation bounds in [8] for two of the three procedures used there: the short-range and short-range-extension algorithms. Our simplified algorithms are both obtained using a streamlined single-source version of the pipelined APSP algorithm in [1].

A key contribution in the deterministic APSP algorithm in [2] is a fast deterministic distributed algorithm for computing a blocker set. The performance of the blocker set algorithm in [2] does not suffice for our faster APSP algorithms (Theorems 1.3 and 1.4). In Section 2 we present a faster blocker set algorithm, which is also a simplification of the blocker set algorithm in [2]. The improved bound that we obtain here for computing a blocker set will not improve the overall bound in [2], but our method could be used there to achieve the same bound with a more streamlined algorithm.

3. Faster (Randomized) APSP for Arbitrary Edge-Weights. For exact APSP in directed graphs with arbitrary edge-weights the only prior nontrivial result known is the -round deterministic algorithm in [2]. We present an algorithm with the following improved randomized bound in Section 4.1.

###### Theorem 1.6.

Let be a directed or undirected edge-weighted graph with arbitrary edge weights. Then, we can compute weighted APSP in in the Congest model in rounds, w.h.p. in .

The corresponding bound for -SSP is .

4. Approximate APSP for Non-negative Edge Weights. In Section 4.2 we present an algorithm that matches the earlier bound for computing approximate APSP in graphs with positive integer edge weights [13, 11] by obtaining the same bound for non-negative edge weights.

###### Theorem 1.7.

Let be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers polynomially bounded in , and where zero-weight edges are allowed. Then, for any we can compute -approximate APSP in rounds deterministically in the Congest model.

Roadmap. The rest of the paper is organized as follows. In Sections 1.2 and 1.3 we review the Congest model and discuss related work. In Section 2 we present our faster APSP and -SSP deterministic distributed algorithms, including our improved deterministic method to compute a blocker set. Section 3 describes our simple algorithms for the short-range and short-range extension problems from Huang et al. [8]. Section 4 presents our results that give Theorems 1.6 and 1.7, and we conclude with Section 5.

### 1.2 Congest Model

In the Congest model, there are independent processors interconnected in a network by bounded-bandwidth links. We refer to these processors as nodes and the links as edges. This network is modeled by graph where refers to the set of processors and refers to the set of links between the processors. Here and .

Each node is assigned a unique ID between 1 and and has infinite computational power. Each node has limited topological knowledge and only knows about its incident edges. For the integer-weighted APSP problem we consider, each edge has a non-negative integer weight (zero weights allowed) that can be represented with bits. Also if the edges are directed, the corresponding communication channels are bidirectional and hence the communication network can be represented by the underlying undirected graph of (this is also the assumption used in [8, 7, 2]). The pipelined algorithm in [1] does not need this feature, and uses only the directed edges in the graph for communication.

The computation proceeds in rounds. In each round each processor can send an -bit message along edges incident to it, and it receives the messages sent to it in the previous round. (If the graph has arbitrary edge weights, a node can send a constant number of distance values and node IDs along each edge in a message.) The model allows a node to send different message along different edges though we do not need this feature in our algorithm. The performance of an algorithm in the Congest model is measured by its round complexity, which is the worst-case number of rounds of distributed communication.

### 1.3 Related Work

Weighted APSP. The current best bound for the weighted APSP problem is due to the randomized algorithm of Huang et al. [8] that runs in rounds. This algorithm works for graphs with polynomially bounded integer edge weights (including zero-weight edges), and the result holds with w.h.p. in . For graphs with arbitrary edge weights, the recent result of Agarwal et al. [2] gives a deterministic APSP algorithm that runs in rounds. This is the current best bound (both deterministic and randomized) for graphs with arbitrary edge weights as well as the best deterministic bound for graphs with integer edge weights.

In this paper we present an algorithm for non-negative integer edge-weights (including zero-weighted edges) that runs in rounds where the shortest path distances are at most and in rounds when the edge weights are bounded by . This result improves on the deterministic APSP bound of Agarwal et al. [2] when either edge weights are at most or shortest path distances are at most , for any .

We also give an improved randomized algorithm for APSP in graphs with arbitrary edge weights that runs in rounds, w.h.p. in .

Weighted -SSP. The current best bound for the weighted -SSP problem is due to the Huang et al’s [8] randomized algorithm that runs in rounds. This algorithm is also randomized and only works for graphs with integer edge weights. The recent deterministic APSP algorithm in [2] can be shown to give an round deterministic algorithm for -SSP. In this paper, we present a deterministic algorithm for positive including zero integer edge-weighted graphs that runs in rounds where the shortest path distances are at most and in rounds when the edge weights are bounded by .

-Approximation Algorithms. For graphs with positive integer edge weights, deterministic -round algorithms for a -approximation to APSP are known [13, 11]. But these algorithms do not handle zero weight edges. In this paper we present a deterministic algorithm that handles zero-weight edges and matches the -round bound for approximate APSP known before for positive edge weights.

## 2 Faster k-SSP Algorithm Using a Blocker Set

In this section we give faster deterministic APSP and -SSP algorithms than the bound in [2] for moderate non-negative edge weights (including zero weights). The overall Algorithm 1 has the same structure as the deterministic round weighted APSP algorithm in [2] but we use a variant of the pipelined APSP algorithm in [1] in place of Bellman-Ford, and we also present new methods within two of the steps.

We first define the following notion of an -hop Consistent SSSP (CSSSP) collection. This notion is implicit in [2] but is not explicitly defined there.

###### Definition 2.1 (Csssp).

Let be a collection of rooted -hop trees in a graph . Then is an -hop CSSSP collection (or simply an -hop CSSSP) if for every the path from to is the same in each of the trees in (in which such a path exists), and is the -hop shortest path from to in the -hop tree rooted at . Further, each contains every vertex that has a shortest path from in with at most hops.

In our improved Algorithm 1, Steps 3-5 are unchanged from the algorithm in [2]. However we give an alternate method for Step 1 to compute -hop CSSSP (see Section 2.1) since the method in [2] takes rounds, which is too large for our purposes. Our new method is very simple and using the pipelined algorithm in [1] it runs in rounds. (An implementation using Bellman-Ford [3] would give an -round bound, which could be used in [2] to simplify that blocker set algorithm.)

Step 2 computes a blocker set, defined as follows.

###### Definition 2.2 (Blocker Set[9, 2]).

Let be a collection of rooted -hop trees in a graph . A set is a blocker set for if every root to leaf path of length in every tree in contains a vertex in . Each vertex in is called a blocker vertex for .

For Step 2 we use the overall blocker set algorithm from [2], which runs in rounds and computes a blocker set of size for the -hop trees constructed in Step 1 of algorithm 1. But this gives only an bound for Step 2 (by setting ), so it will not help us to improve the bound on the number of rounds for APSP. Instead, we modify and improve a key step where that earlier blocker set algorithm has a round preprocessing step. (Our improved method here will not help to improve the bound in [2] but does help to obtain a better bound here in conjunction with the pipelined algorithm.) We give the details of our method for Step 2 in Section 2.2.

###### Lemma 2.3.

Algorithm 1 computes -SSP in rounds.

###### Proof.

The correctness of Algorithm 1 is established in [2]. Step 1 runs in rounds by Lemma 2.5 in Section 2.1. In Section 2.2 we will give an rounds algorithm to find a blocker set of size . Simple round algorithms for Steps 3 and 4 are given in [2]. Step 5 has no communication. Hence the overall bound for Algorithm 1 is rounds. Since this gives the desired bound. ∎

###### Proofs of Theorem 1.3 and 1.4:.

Using in Lemma 2.3 we obtain the bounds in Theorem 1.4.

If edge weights are bounded by , the weight of any -hop path is at most . Hence by Lemma 2.3, the -SSP algorithm (Algorithm 1) runs in rounds. Setting we obtain the bounds stated in Theorem 1.3. ∎

### 2.1 Computing Consistent h-hop trees

In Section 1 we defined a natural notion of an -hop SSSP tree rooted at a source , as a rooted tree which contains an -hop shortest path from to every other vertex to which there exists a path from with at most hops. We also defined tie-breaking rules for the case when multiple paths from to satisfy this definition: a path with the smallest number of hops is chosen, with further ties broken by choosing the predecessor vertex with smallest ID. Each -hop tree constructed by the pipelined -SSP algorithm [1] satisfies the definition of an -hop SSSP tree (as constructed using the pointers) and these trees can also be constructed for each source using the Bellman-Ford algorithm [3].

The definition of a CSSSP collection (Def. 2.1) places additional stringent conditions on the structure of -hop SSSP trees in the collection, and neither the pipelined algorithm in [1] nor Bellman-Ford is guaranteed to construct this collection. At the same time, the trees in a CSSSP collection may not satisfy the definition of -hop SSSP in Sec. 1 since we may not have a path from vertex to vertex in a -hop CSSSP tree even if there exists a path from to with at most hops. See Fig. 1.

Our method to construct an -hop CSSSP collection is very simple: We execute the pipelined algorithm in [1] to construct -hop SSSP trees instead of -hop SSSP trees. Our CSSSP collection will retain the initial hops of each of these -hop SSSP trees. We now show that this simple construction results in an -hop CSSSP collection. Thus we are able to construct -hop CSSSPs by incurring just a constant factor overhead in the number of rounds over the bound for pipelined algorithm.

###### Lemma 2.4.

Let be a distributed algorithm that computes -SSP trees of shortest path distance at most in an -node graph in round. Consider running Algorithm  using the hop-length bound , and let be the collection of -hop trees formed by retaining the initial hops in each of these -hop trees. Then the collection forms an -hop CSSSP collection, and this collection can be computed in rounds.

###### Proof.

If not, then there exist vertices and trees such that the paths from to in and are different. Let and be the corresponding paths in these trees.

There are three possible cases: (1) when (2) when paths and have same weight but different hop-lengths (3) when both and have same weight and hop-length.

(1) : w.l.o.g. assume that . Now if we replace in with , we get a path of smaller weight from to of hop-length at most and weight at most . But this violates the definition of -SSP (Definition 1.1) since is a -SSP and hence it should contain a minimum weight path from to of hop-length at most , and not the path , resulting in a contradiction.

(2) paths and have same weight but different hop-lengths. w.l.o.g. assume that path has smaller hop-length than . Then and hence . This again violates the -SSP definition (Definition 1.1) since is a -SSP and hence it should contain the path from to as it has smaller number of hops than the path .

(3) both and have same weight and hop-length. Let be the last edge on the path and let be the last edge on the path . w.l.o.g. assume that . Then again since is a -SSP, by -SSP definition (Definition 1.1) must contain the path from to since its predecessor vertex has smaller ID than the predecessor vertex of path . ∎

###### Lemma 2.5.

An -hop CSSSP collection can be computed in rounds using the pipelined APSP algorithm in [1] and in rounds using Bellman-Ford [3].

We now show two useful properties of an -hop CSSSP collection that we will use in our blocker set algorithm in the next section. (Lemma 2.7 is also implicitly established in [2]).

###### Lemma 2.6.

Let be a vertex in and let be the union of the edges in the collection of subtrees rooted at in the trees in a -hop CSSSP collection . Then forms an out-tree rooted at .

###### Proof.

If not, there exist nodes and and trees and such that the path from to in and path from to in first diverge from each other after starting from and then coincide again at some vertex . But since is an -hop CSSSP collection, by Lemma 2.4 the path from to in the collection is unique. ∎

###### Lemma 2.7.

Let be a vertex in and let be the collection of paths from source node to in the trees in a -hop CSSSP collection . Then forms an in-tree rooted at .

### 2.2 Computing a Blocker Set

Our overall blocker set algorithm runs in rounds. It differs from the blocker set algorithm in [2] by developing faster algorithms for two steps that take rounds in [2].

The first step in [2] that takes rounds is the step that computes the initial ‘scores’ at all nodes for all -hop trees in the CSSSP collection. The score of node in an -hop tree is the number of ’s descendants in that tree. Instead of the rounds, we can compute scores for all trees at all nodes in rounds with a timestamp technique given in [14] for propagating values from descendants to ancestors in the shortest path trees within the same bound as the APSP algorithm.

To explain the second -round step in [2], we first give a brief recap of the blocker set algorithm in [2]. This algorithm picks nodes to be added to the blocker set greedily. The next node that is added to the blocker set is one that lies in the maximum number of paths in the -hop trees that have not yet been covered by the already selected blocker nodes. To identify such a node, the algorithm maintains at each node a count (or score) of the number of descendant leaves in each tree, since the sum of these counts is precisely the number of root-to-leaf paths in which lies. Once all vertices have their overall score, the new blocker node can be identified as one with the maximum score. It now remains for each node to update its scores to reflect the fact that paths through no longer exist in any of the trees. This update computation is divided into two steps in [2]. In both steps, the main challenge is for a given node to determine, in each tree , whether it is an ancestor of , a descendant of , or unrelated to .

1. Updates at Ancestors. For each , in each tree where is an ancestor of , needs to reduce its score for by ’s score for since all of those descendant leaves have been eliminated. In [2] an -round pipelined algorithm (using the in-tree property in Lemma 2.7) is given for this update at all nodes in all trees, and this suffices for our purposes.

2. Updates at Descendants. For each , in each tree where is a descendant of , needs to reduce its score for to zero, since all descendant leaves are eliminated once is removed. In [2] this computation is performed by an -round precomputation in which each vertex identifies all of its ancestors in all of the -hop trees and thereafter can readily identify the trees in which it is a descendant of a newly chosen blocker node once broadcasts its identity to all nodes. But this is too expensive for our purposes.

Here, we perform no precomputation but instead in Algorithm 2 we use the property in Lemma 2.6 to develop a method similar to the one for updates at ancestors. Initially creates a list, , where it adds the IDs of all the source nodes such that lies in tree . In round , sends the -th entry in to all its children in . Since (in Lemma 2.6) is a tree, every node receives at most one message in a given round . If receives the message for source in round , it forwards this message to all its children in in the next round, , and also set its score for source to . Similar to the algorithm for updating ancestors of  [2], it is readily seen that every descendant of in every tree receives a message for by round .

###### Lemma 2.8.

Algorithm 2 correctly updates the scores of all nodes in every tree in which is a descendant of in rounds.

## 3 Simplified Versions of Short-Range Algorithms in [8]

We describe here simplified versions of the short-range and short-range-extension algorithms used in the randomized round APSP algorithm in Huang et al. [8]. Our short-range Algorithm 3 is inspired by the pipelined APSP algorithm in [1] and is much simpler than it since it is for a single source.

Given a hop-length and a source vertex , the short-range algorithm in [8] computes the -hop shortest path distances from source in a graph (obtained through ‘scaling’) where . The scaled graph has different edge weights for different sources, and hence -hop APSP is computed through -hop SSSP (or short-range) computations, each of which runs with dilation (i.e., number of rounds) and congestion (i.e., maximum number of messages along an edge) . By running this algorithm using each vertex as source, -hop APSP is computed in in rounds w.h.p. in using a result in Ghaffari’s framework [6], which gives a randomized method to execute this collection of different short-range executions simultaneously in rounds.

The short-range algorithm in [8] for a given source runs in two stages:. Initially every zero edge-weight is increased to a positive value and then -hop SSSP is computed using a BFS variant in rounds. This gives an approximation to the -hop SSSP where the additive error is at most . This error is then fixed by running Bellman-Ford algorithm [3] for rounds. The total round complexity of this SSSP algorithm is and the congestion is .

We now describe our simplified short-range algorithm (Algorithm 3) which has the same dilation and congestion . Here

is the current best estimate for the shortest path distance from

at node and is the hop-length of the corresponding path. Source node initializes and values to zero and sends these values to its neighbors in round (Step 2). At the start of a round , each node checks if its current and values satisfy , and if so, it sends this estimate to each of its neighbors. To bound the number of such messages sends throughout the entire execution, we note that will send another message in a future round only if it receives a smaller value with higher value. But since and values are non-negative integers, can send at most messages to its neighbors throughout the entire execution.

We now establish that vertex will receive the message that creates the pair at before round , and hence will be able to perform the send in Step 2 of Algorithm 3.

###### Lemma 3.1.

Let be a path from source to vertex with the minimum number of hops among all -hop shortest paths from to . Let have hops and weight (distance) . If receives the message for the pair , in round then .

###### Proof.

We show this by induction on round . The base case is trivially satisfied since already knows and values at the start (Round ).

Assume inductively that the lemma holds at all vertices up to round . Let be the predecessor of on the path . Then must have received the message for its pair , in a round . Let . Then, by the inductive assumption. So will send the message , to in round in Step 2 of Algorithm 3. But , since . Hence the round in which receives the message for the pair , is less than .

This establishes the induction step and the lemma. ∎

If shortest path distances are bounded by , Algorithm 3 runs in rounds with congestion at most . And if (as in [8]), then we can compute shortest path distances from to every node in rounds.

We can similarly simplify the short-range-extension algorithm in [8], where some nodes already know their distance from source and the goal is to compute shortest paths from by extending these already computed shortest paths to by another hops. To implement this, we only need to modify the initialization in Algorithm 3 so that each such node initializes with this already computed distance. The round complexity is again and the congestion per source is . This gives us the following result.

###### Lemma 3.2.

Let be a directed or undirected graph, where all edge weights are non-negative distances (and zero-weight edges are allowed), and where shortest path distances are bounded by . Then by using Algorithm 3, we can compute -hop SSSP and -hop extension in rounds with congestion bounded by .

As in [8] we can now combine our Algorithm 3 with Ghaffari’s randomized framework [6] to compute -hop APSP and -hop extensions (for all source nodes) in rounds w.h.p. in . The result can be readily modified to include the number of sources, , by sending the current estimates in round , where as in pipelined algorithm in [1] (instead of ), and the resulting algorithm runs in rounds with congestion bounded by . Then we can compute -hop -SSP and -hop extensions for all sources in rounds.

## 4 Additional Results

### 4.1 A Faster Randomized Algorithm for Weighted APSP with Arbitrary Edge-Weights

We adapt the randomized framework of Huang et al. [8] to obtain a faster randomized algorithm for weighted APSP with arbitrary edge weights. Our randomized algorithm runs in rounds w.h.p. in , improving on the previous best bound of rounds (which is deterministic) in Agarwal et al. [2]. We describe our randomized algorithm below.

As described in Section 3, Huang et al.[8] use two algorithms short-range and short-range-extension for integer-weighted APSP for which they have randomized algorithms that run in rounds w.h.p. in . (We presented simplified versions of these two algorithms in Section 3.) Since we consider arbitrary edge weights here, we will instead use rounds of the Bellman-Ford algorithm [3] for both steps, which will take rounds for source nodes.

We keep the remaining steps in [8] unchanged: These steps involve having every ‘center’ broadcast its estimated shortest distances, , from every other center , and each source node sending its correct shortest distance, , to each center . (The set of centers is a random subset of vertices in of size .) These steps are shown in [8] to take rounds in total w.h.p. in , where . This gives an overall round complexity for our algorithm. Setting and , we obtain the desired bound of in Theorem 1.6.

### 4.2 An ~O(n)-Rounds (1+ϵ) Approximation Algorithm for Weighted APSP with Non-negative Integer Edge-Weights

Here we deal with the problem of finding -approximate solution to the weighted APSP problem. If edge-weights are strictly positive, the following result is known.

###### Theorem 4.1 ( [13, 11]).

There is a deterministic algorithm that computes -approximate APSP on graphs with positive polynomially bounded integer edge weights in rounds.

The above result does not hold when zero weight edges are present. Here we match the deterministic -round bound for this problem with an algorithm that also handles zero edge-weights.

We first compute reachability between all pairs of vertices connected by zero-weight paths. This is readily computed in rounds, e.g., using [12, 14] while only considering only the zero weight edges (and ignoring the other edges).

We then consider shortest path distances between pairs of vertices that have no zero-weight path connecting them. The weight of any such path is at least . To approximate these paths we increase the zero edge-weights to and transform every non-zero edge weight to . Let this modified graph be . Thus the weight of an -hop path in , , satisfies . Since the modified graph has polynomially bounded positive edge weights, we can use the result in Theorem 4.1 to compute -approximate APSP on this graph in rounds.

Fix a pair of vertices . Let be a shortest path from to in , and let its hop-length be . Then . Let be a -approximate shortest path from to , and let its hop-length be . Then . Dividing by gives us (as long as and since ), and this establishes Theorem 1.7.

## 5 Conclusion

We have presented new improved deterministic distributed algorithms for weighted shortest paths (both APSP, and for sources) in graphs with moderate non-negative integer weights. These results build on our recent pipelined algorithm for weighted shortest paths [1]. We have also presented simplications to two procedures in the randomized APSP algorithm in Huang et al. [8] by streamlining the pipelined APSP algorithm in [1] for SSSP versions. A key feature of our shortest path algorithms is that they can handle zero-weighted edges, which are known to present a challenge in the design of distributed algorithms for non-negative integer weights. We have also presented a faster and more streamlined algorithm to compute a blocker set, an improved randomized APSP (and -SSP) algorithm for arbitrary edge-weights, and an approximate APSP algorithm that can handle zero-weighted edges.

An important area for further research is to investigate further improvements to the deterministic distributed computation of a blocker set, beyond the algorithm in [2] and the improvements we have presented here.

## References

• [1] U. Agarwal and V. Ramachandran. A faster deterministic distributed algorithm for weighted apsp through pipelining. arXiv preprint arXiv:1807.08824.v2, 2018.
• [2] U. Agarwal, V. Ramachandran, V. King, and M. Pontecorvi. A deterministic distributed algorithm for exact weighted all-pairs shortest paths in rounds. In Proc. PODC, pages 199–205. ACM, 2018.
• [3] R. Bellman. On a routing problem. Quarterly of applied mathematics, 16(1):87–90, 1958.
• [4] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269–271, 1959.
• [5] M. Elkin. Distributed exact shortest paths in sublinear time. In Proc. STOC, pages 757–770. ACM, 2017.
• [6] M. Ghaffari. Near-optimal scheduling of distributed algorithms. In Proc. PODC, pages 3–12. ACM, 2015.
• [7] M. Ghaffari and J. Li. Improved distributed algorithms for exact shortest paths. In Proc. STOC, pages 431–444. ACM, 2018.
• [8] C.-C. Huang, D. Nanongkai, and T. Saranurak. Distributed exact weighted all-pairs shortest paths in rounds. In Proc. FOCS, pages 168–179. IEEE, 2017.
• [9] V. King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closure in digraphs. In Proc. FOCS, pages 81–89. IEEE, 1999.
• [10] S. Krinninger and D. Nanongkai. A faster distributed single-source shortest paths algorithm. In Proc. FOCS. IEEE, 2018.
• [11] C. Lenzen and B. Patt-Shamir. Fast partial distance estimation and applications. In Proc. PODC, pages 153–162. ACM, 2015.
• [12] C. Lenzen and D. Peleg. Efficient distributed source detection with limited bandwidth. In Proc. PODC, pages 375–382. ACM, 2013.
• [13] D. Nanongkai. Distributed approximation algorithms for weighted shortest paths. In Proc. STOC, pages 565–573. ACM, 2014.
• [14] M. Pontecorvi and V. Ramachandran. Distributed algorithms for directed betweenness centrality and all pairs shortest paths. arXiv preprint arXiv:1805.08124, 2018.