Ingraph theory, thediameter of a connected undirected graph is the farthestdistance between any two of its vertices. That is, it is thediameter of a set for the set of vertices of the graph, and for theshortest-path distance in the graph. Diameter may be considered either for weighted or for unweighted graphs. Researchers have studied the problem of computing the diameter, both in arbitrary graphs and in special classes of graphs.
Diameters of unweighted and weighted graphs
The diameter of a disconnected graph may be defined to be infinite, or undefined.
Thedegree diameter problem seeks tight relations between the diameter, number of vertices, anddegree of a graph. One way of formulating it is to ask for the largest graph with given bounds on its degree and diameter. For any fixed degree, this maximum size is exponential in diameter, with the base of the exponent depending on the degree.[1]
Thegirth of a graph, the length of its shortest cycle, can be at most for a graph of diameter. Theregular graphs for which the girth is exactly are theMoore graphs. Only finitely many Moore graphs exist, but their exact number is unknown. They provide the solutions to the degree diameter problem for their degree and diameter.[2]
The diameter of a graph can be computed by using ashortest path algorithm to compute shortest paths between all pairs of vertices, and then taking the maximum of the distances that it computes. For instance, in a graph with positive edge weights, this can be done by repeatedly usingDijkstra's algorithm, once for each possible starting vertex. In a graph with vertices and edges, this takes time. Computing all-pairs shortest paths is the fastest known method for computing the diameter of a weighted graph exactly.[4]
In an unweighted-graph, Dijkstra's algorithm may be replaced by abreadth-first search, giving time. Alternatively, the diameter may be computed using an algorithm based onfast matrix multiplication, in time proportional to the time for multiplying matrices, approximately using known matrix multiplication algorithms.[5] For sparse graphs, with few edges, repeated breadth-first search is faster than matrix multiplication. Assuming thestrong exponential time hypothesis, repeated breadth-first search is near-optimal: this hypothesis implies that no algorithm can achieve time for any.[4]
It is possible to approximate the diameter of a weighted graph to within anapproximation ratio of 3/2, in time, where the notation hides logarithmic factors in the time bound.[6] Under the exponential time hypothesis, no substantially more accurate approximation, substantially faster than all pairs shortest paths, is possible.[4]
The diameter can be computed in linear time forinterval graphs,[7] and in near-linear time for graphs of boundedtreewidth.[8] Inmedian graphs, the diameter can be found in the subquadratic time bound.[9]In any class of graphs closed undergraph minors, such as theplanar graphs, it is possible to compute the diameter in subquadratic time, with an exponent depending on the graph family.[10]
^abcRoditty, Liam;Vassilevska Williams, Virginia (2013), "Fast approximation algorithms for the diameter and radius of sparse graphs", in Boneh, Dan; Roughgarden, Tim; Feigenbaum, Joan (eds.),Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013, Association for Computing Machinery, pp. 515–524,doi:10.1145/2488608.2488673,ISBN978-1-4503-2029-0
^Cygan, Marek; Gabow, Harold N.; Sankowski, Piotr (2012), "Algorithmic applications of Baur-Strassen's theorem: shortest cycles, diameter and matchings",53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS 2012, New Brunswick, NJ, USA, October 20-23, 2012, IEEE Computer Society, pp. 531–540,arXiv:1204.1616,doi:10.1109/FOCS.2012.72,ISBN978-0-7695-4874-6
^Chechik, Shiri; Larkin, Daniel H.; Roditty, Liam; Schoenebeck, Grant; Tarjan, Robert Endre; Vassilevska Williams, Virginia (2014), "Better approximation algorithms for the graph diameter", in Chekuri, Chandra (ed.),Proceedings of the Twenty-Fifth Annual ACM–SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, SIAM, pp. 1041–1052,doi:10.1137/1.9781611973402.78,ISBN978-1-61197-338-9
^Olariu, Stephan (1990), "A simple linear-time algorithm for computing the center of an interval graph",Int. J. Comput. Math.,34 (3–4):121–128,doi:10.1080/00207169008803870
^Bringmann, Karl; Husfeldt, Thore; Magnusson, Måns (2020), "Multivariate analysis of orthogonal range searching and graph distances",Algorithmica,82 (8):2292–2315,doi:10.1007/s00453-020-00680-z,MR4132892
^Bergé, Pierre; Ducoffe, Guillaume; Habib, Michel (2024), "Subquadratic-time algorithm for the diameter and all eccentricities on median graphs",Theory of Computing Systems,68 (1):144–193,arXiv:2110.02709,doi:10.1007/s00224-023-10153-9,MR4699679
^Ducoffe, Guillaume; Habib, Michel; Viennot, Laurent (2022), "Diameter, eccentricities and distance oracle computations onH-minor free graphs and graphs of bounded (distance) Vapnik-Chervonenkis dimension",SIAM Journal on Computing,51 (5):1506–1534,arXiv:1907.04385,doi:10.1137/20M136551X,MR4502132