A topological sorting algorithm for large graphs

  • Authors:
  • Deepak Ajwani;Adan Cosgaya-Lozano;Norbert Zeh

  • Affiliations:
  • University College Cork, Ireland;Dalhousie University, Canada;Dalhousie University, Canada

  • Venue:
  • Journal of Experimental Algorithmics (JEA)
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present an I/O-efficient algorithm for topologically sorting directed acyclic graphs, called IterTS. In the worst case, our algorithm is extremely inefficient and performs O(n ċ sort(m)) I/Os. However, our experiments show that IterTS achieves good performance in practice. To evaluate IterTS, we compared its running time to those of three competitors: PeelTS, an I/O-efficient implementation of the standard strategy of iteratively removing sources and sinks; ReachTS, an I/O-efficient implementation of a recent parallel divide-and-conquer algorithm based on reachability queries; and SeTS, a standard DFS-based topological sorting built on top of a semiexternal DFS algorithm. In our evaluation on various types of input graphs, IterTS consistently outperformed PeelTS and ReachTS by at least an order of magnitude in most cases. SeTS outperformed IterTS on most graphs whose vertex sets fit in memory. However, IterTS often came close to the running time of SeTS on these inputs and, more importantly, SeTS was not able to process graphs whose vertex sets were beyond the size of main memory, while IterTS was able to process such inputs efficiently.