arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1901.03689cs.DS
收藏

半流模型中的深度优先搜索

Depth First Search in the Semi-streaming Model

Shahbaz Khan, Shashank K. Mehta

摘要:

深度优先搜索(DFS)树是解决各种图问题的基本数据结构.经典的DFS算法对于具有$m$和$n$顶点的图需要$O(m+n)$时间。在流模型中,算法被允许在输入图上进行几次(优选地是单次),对所使用的局部空间的大小具有限制。简单地说,DFS树可以通过使用$O(m)$空间的单次遍历来计算。在允许$O(n)$空间的半流模型中,它可以在$O(n)$过程中计算,其中每个过程向DFS树添加一个顶点。然而,即使在任何宽松的流式传输环境中,使用$o(m)$空间使用$o(n)$遍数来计算DFS树仍然是一个开放的问题。我们提出了第一个半流算法,计算DFS树的无向图在$o(n)$通过使用$o(m)$空间。我们首先描述一个非常简单的算法,它最多需要使用$O(nk)$空间的$\lceil n/k\rceil$遍,其中$k$是任何正整数。然后,我们改进了这个算法,使用更多涉及的技术,以减少通过$\lceil h/k\rceil$类似的空间约束下,其中$h$是计算DFS树的高度的数量。特别地,该算法改进了计算的DFS树是浅的(具有$o(n)$高度)的情况下的边界。此外,该算法作为一个框架,允许使用任何算法的灵活性,以保持存储的稀疏子图的DFS树作为一个黑盒子,这可能是独立的利益。这两种算法基本上证明了存在的空间和计算DFS树所需的通道数之间的权衡。此外,我们评估这些算法的实验,揭示了他们的特殊性能在实践中。对于随机图和实数图,即使只允许$O(n)$空间,它们也只需要几遍。

英文摘要:

Depth first search (DFS) tree is a fundamental data structure for solving various graph problems. The classical DFS algorithm requires $O(m+n)$ time for a graph having $n$ vertices and $m$ edges. In the streaming model, an algorithm is allowed several passes (preferably single) over the input graph having a restriction on the size of local space used. Trivially, a DFS tree can be computed using a single pass using $O(m)$ space. In the semi-streaming model allowing $O(n)$ space, it can be computed in $O(n)$ passes, where each pass adds one vertex to the DFS tree. However, it remains an open problem to compute a DFS tree using $o(n)$ passes using $o(m)$ space even in any relaxed streaming environment. We present the first semi-streaming algorithms that compute a DFS tree of an undirected graph in $o(n)$ passes using $o(m)$ space. We first describe an extremely simple algorithm that requires at most $\lceil n/k\rceil$ passes using $O(nk)$ space, where $k$ is any positive integer. We then improve this algorithm by using more involved techniques to reduce the number of passes to $\lceil h/k\rceil$ under similar space constraints, where $h$ is the height of the computed DFS tree. In particular, this algorithm improves the bounds for the case where the computed DFS tree is shallow (having $o(n)$ height). Moreover, this algorithm is presented as a framework that allows the flexibility of using any algorithm to maintain a DFS tree of a stored sparser subgraph as a black box, which may be of independent interest. Both these algorithms essentially demonstrate the existence of a trade-off between the space and number of passes required for computing a DFS tree. Furthermore, we evaluate these algorithms experimentally which reveals their exceptional performance in practice. For both random and real graphs, they require merely a few passes even when allowed just $O(n)$ space.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑