views:

85

answers:

1

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?

Thanks in advance.

Raghava.

+2  A: 

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.
Falk Hüffner
@Falk: Thank you for the reply. I guess the heuristic speedup would be useful only if there many strongly connected components in the graph. I need to observe the graphs generated by different data sets to see if this is the case. But if that is not the case, then Warshall's is the best one isn't it. I thought there might be some more.
Raghava
I think approach mentioned in the first bullet point of the first link is the way to go. It'll be relatively easy to parallelize, too!
Tom Sirgedas
@Tom: As of now, I am already using a multi threaded graph library. So I am using their graph representation which isn't a matrix.
Raghava