Trading uninitialized space for time

  • Authors:
  • Gabriel Valiente

  • Affiliations:
  • Department of Software, Technical University of Catalonia, E-08034 Barcelona, Spain

  • Venue:
  • Information Processing Letters
  • Year:
  • 2004

Quantified Score

Hi-index 0.89

Visualization

Abstract

The design of efficient graph algorithms usually precludes the test of edge existence, because an efficient support of that operation already requires time Ω(n2) for the initialization of an adjacency-matrix representation. We describe an alternative representation of static directed graphs taking Θ(n+m) initialization time and using Θ(n2) space, which supports the efficient implementation of all usual operations on static graphs. The sparse graph representation allows the design of efficient graph algorithms using both iteration over all vertices adjacent with a given vertex and edge-existence operations, although at the expense of additional (uninitialized) space which may, nevertheless, be used for other purposes. To the best of our knowledge, the representation leads to the first graph algorithms with the disconcerting property that the time complexity is better than the space complexity.