Abstract

Research on space efficient graph algorithms, particularly for st-connectivity, has a long history including the celebrated polynomial time, O(lg n) bits1 algorithm in undirected graphs by Reingold J. JACM. 55(4) (2008), and polynomial time, \(n/2^{\Theta (\sqrt {\lg n})}\) bits algorithm in directed graphs by Barnes et al. SICOMP. 27(5), 1273–1282 (1998). Recent works by Asano et al. ISAAC (2014) and Elmasry et al. STACS (2015), reconsidered classical fundamental graph algorithms focusing on improving the space complexity. Elmasry et al. gave, among others, an implementation of breadth first search (BFS) in a graph G with n vertices and m edges, taking the optimal O(m + n) time using O(n) bits improving the naive O(n lg n) bits implementation. Similarly, Asano et al. provided space efficient implementations for performing depth first search (DFS) in a graph G. We continue this line of work focusing on improving the space requirement for implementing a few classical graph algorithms. Our first result is a simple data structure that can maintain any subset S of a universe of u elements using just u + o(u) bits and supports in constant time, apart from the standard insert, delete and membership queries, the operation findany that finds and returns any element of the set (or outputs that the set is empty). It can also enumerate all elements present currently in the set in no particular order in O(k + 1) time where k is the number of elements currently belonging to the set. While this data structure supports a weaker set of operations than that of Elmasry et al. STACS (2015), it is simple, more space efficient and is sufficient to support a BFS implementation optimally in O(m + n) time using at most 2n + o(n) bits. Later, we further improve the space requirement of BFS to at most n lg 3 + o(n) bits albeit with a slight increase in running time to O(m lg nf(n)) time where f(n) is any extremely slow growing function of n, and the o term in the space is a function of f(n). We also discuss a similar time-space tradeoff result for finding a minimum weight spanning tree of a weighted (bounded by polynomial in n) undirected graph using n + O(n/f(n)) bits and O(m lg nf(n)) time, for any function f(n) such that 1 ≤ f(n) ≤ n. For DFS in a graph G, we provide an implementation taking O(m + n) time and O(n lg m/n) bits. This partially answers at least for sparse graphs, a question asked by Asano et al. ISAAC (2014) whether DFS can be performed in O (m + n) time and using O(n) bits, and also simultaneously improves the DFS result of Elmasry et al. STACS (2015). Using our DFS algorithm and other careful implementations, we show how one can also test for biconnectivity, 2-edge connectivity, and find cut vertices and bridges of a given undirected graph within the same time and space bounds; earlier classical linear time algorithms for these problems used Ω(n lg n) bits of space.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call