Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best known transitive closure algorithm for a directed graph?

In terms of runtime, what is the best known transitive closure algorithm for directed graphs?

I am currently using Warshall's algorithm but its O(n^3). Although, due to the graph representation my implementation does slightly better (instead of checking all edges, it only checks all out going edges). Is there any transitive closure algorithm which is better than this? In particular, is there anything specifically for shared memory multi-threaded architectures?

like image 525
Raghava Avatar asked Aug 18 '10 23:08

Raghava


2 Answers

This paper discusses the performance of various transitive closure algorithms:

http://www.vldb.org/conf/1988/P382.PDF

One interesting idea from the paper is to avoid recomputing the entire closure as the graph changes.

There is also this page by Esko Nuutila, which lists a couple of more recent algorithms:

http://www.cs.hut.fi/~enu/tc.html

His PhD thesis listed on that page may be the best place to start:

http://www.cs.hut.fi/~enu/thesis.html

From that page:

The experiments also indicate that with the interval representation and the new algorithms, the transitive closure can be computed typically in time linear to the size of the input graph.

like image 95
AmigoNico Avatar answered Nov 14 '22 02:11

AmigoNico


The Algorithm Design manual has some useful information. Key points:

  • Transitive closure is as difficult as matrix multiplication; so the best known bound is the Coppersmith–Winograd algorithm which runs in O(n^2.376), but in practice it's probably not worthwhile to use matrix multiplication algorithms.
  • For a heuristic speedup, calculate strongly connected components first.
like image 12
Falk Hüffner Avatar answered Nov 14 '22 03:11

Falk Hüffner