English

Computing the diameter polynomially faster than APSP

Data Structures and Algorithms 2011-01-14 v2

Abstract

We present a new randomized algorithm for computing the diameter of a weighted directed graph. The algorithm runs in \Ot(M\w/(\w+1)n(\w2+3)/(\w+1))\Ot(M^{\w/(\w+1)}n^{(\w^2+3)/(\w+1)}) time, where \w<2.376\w < 2.376 is the exponent of fast matrix multiplication, nn is the number of vertices of the graph, and the edge weights are integers in {M,...,0,...,M}\{-M,...,0,...,M\}. For bounded integer weights the running time is O(n2.561)O(n^{2.561}) and if \w=2+o(1)\w=2+o(1) it is \Ot(n7/3)\Ot(n^{7/3}). This is the first algorithm that computes the diameter of an integer weighted directed graph polynomially faster than any known All-Pairs Shortest Paths (APSP) algorithm. For bounded integer weights, the fastest algorithm for APSP runs in O(n2.575)O(n^{2.575}) time for the present value of \w\w and runs in \Ot(n2.5)\Ot(n^{2.5}) time if \w=2+o(1)\w=2+o(1). For directed graphs with {\em positive} integer weights in {1,...,M}\{1,...,M\} we obtain a deterministic algorithm that computes the diameter in \Ot(Mn\w)\Ot(Mn^\w) time. This extends a simple \Ot(n\w)\Ot(n^\w) algorithm for computing the diameter of an {\em unweighted} directed graph to the positive integer weighted setting and is the first algorithm in this setting whose time complexity matches that of the fastest known Diameter algorithm for {\em undirected} graphs. The diameter algorithms are consequences of a more general result. We construct algorithms that for any given integer dd, report all ordered pairs of vertices having distance {\em at most} dd. The diameter can therefore be computed using binary search for the smallest dd for which all pairs are reported.

Keywords

Cite

@article{arxiv.1011.6181,
  title  = {Computing the diameter polynomially faster than APSP},
  author = {Raphael Yuster},
  journal= {arXiv preprint arXiv:1011.6181},
  year   = {2011}
}

Comments

revised to handle negative weights; faster algorithm for positive weights; added observation regarding the unweighted case

R2 v1 2026-06-21T16:50:13.347Z