For an undirected, unweighted graph, is there any difference in the time complexity of the algorithm to compute its average shortest path length vs, the complexity of the algorithm which computes the diameter of the graph, ie, the longest shortest path between two vertices?
For an undirected, unweighted graph, is there any difference in the time complexity of
Share
According to Wikipedia, to calculate the diameter of the graph, you should first find the all-pairs shortest path. After calculating the all-pairs shortest path, both algorithms reduce down to a O(V^2) calculation so their complexities are the same.