Opened 11 months ago

# Approximate Algorithm for Diameter of graph

Reported by: gh-Hrishabh-yadav major graph theory dcoudert N/A

### Description

Currently sage implements Multisweep algorithm with iFUB to find Diameter of undirected unweighted graph, whose complexity in worst case is O(M*N) M=Number of edges, N=Number of vertices. I came across this paper :- https://epubs.siam.org/doi/pdf/10.1137/S0097539796303421 which implements approximate algorithm for diameter for both (un)weighted and (un)directed graph.

This algorithm develops the estimate of E, where (2/3)*∆ ≤ E ≤ ∆ . ∆ being diameter of graph. This algorithm works 5 times faster than other approximations, As there are no current algorithm for diameter of weighted graph which doesn't use All pair shortest path(ASAP) algorithm, This algorithm might be quite useful for finding diameter of large sparse graphs.

### comment:1 Changed 11 months ago by dcoudert

A significant research effort has been done since 2009 (the paper you cite is from 1999) to design fast exact algorithms for the diameter of (un)weighted (directed) graphs. So why not implementing the weighted version of iFUB instead of an approximation ?

### comment:2 Changed 11 months ago by gh-Hrishabh-yadav

Most of the paper have generalised the same multisweep algorithm with Dijikstra instead BFS. None of them haven't actually written much about it. Do have any good research paper explaining complexity of iFUB with dijikstra. Thanks:)

### comment:3 follow-up: ↓ 4 Changed 11 months ago by gh-Hrishabh-yadav

This paper:- http://pages.di.unipi.it/marino/diameter.pdf shows us that we can find diameter of directed graph using DiFUB. This paper also suggested for weighted graphs we can use Dijikstra instead of BFS. So complexity for weighted graphs in worst case should be O(N*M*Log(N)), but similarly like unweighted graphs(O(M)), average complexity of weighted will be O(M*log(n)), which will far better for sparse graphs than any other algorithm.

### comment:4 in reply to: ↑ 3 Changed 11 months ago by dcoudert

This paper:- http://pages.di.unipi.it/marino/diameter.pdf shows us that we can find diameter of directed graph using DiFUB. This paper also suggested for weighted graphs we can use Dijikstra instead of BFS.

The complexity of all these exact algorithms is O(n * SSSP), where SSSP is the time complexity for single source shortest-path tree. In general in the paper they use BFS instead of Dijkstra to ease the presentation, but they all say (including in the iFUB paper) that you can replace BFS by Dijkstra.

So complexity for weighted graphs in worst case should be O(N*M*Log(N)), but similarly like unweighted graphs(O(M)), average complexity of weighted will be O(M*log(n)), which will far better for sparse graphs than any other algorithm.

I don't know where you found an average time complexity proof for iFUB/DiFUB in (un)weighted graphs. I'm not aware of any such proof.

The (currently) best theoretical explanation of the good performances of such algorithms is in http://arxiv.org/abs/1803.04660.

### comment:5 Changed 9 months ago by embray

• Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

Note: See TracTickets for help on using tickets.