工程化半流式深度优先搜索算法
Engineering Semi-streaming DFS algorithms
AI总结:
本文针对半流式模型下的深度优先搜索问题,通过实验分析和多种启发式优化,显著提升了现有算法的空间与遍历次数权衡性能,使多数情况下仅需单次遍历即可完成计算。
摘要:
深度优先搜索(DFS)是一个具有广泛应用的基础图问题。对于具有 $n$ 个顶点和 $m$ 条边的图 $G=(V,E)$,DFS 树可以在 $O(m+n)$ 时间内使用 $O(m)$ 空间计算得到,其中 $m=O(n^2)$。在流式环境中,大多数图问题在半流式模型下被研究,该模型允许对输入进行多次遍历(最好是一次),并允许 $O(nk)$ 的局部空间,其中 $k=o(n)$。显然,使用 $O(m)$ 空间可以在一次遍历内计算 DFS,而使用 $O(n)$ 空间则可以在 $O(n)$ 次遍历内完成计算。Khan 和 Mehta [STACS19] 提出了若干算法,允许在空间和遍历次数之间进行权衡,其中 $O(nk)$ 空间对应 $O(n/k)$ 次遍历。他们还通过实验分析表明,即使在 $O(n)$ 空间下,其算法在实际中也只需很少的遍历次数。Chang 等人 [STACS20] 针对同一问题给出了另一种证明,并提出了一个需要 $O(n~poly\log n)$ 空间的 $O(\sqrt{n})$ 次遍历算法,在空间和遍历次数之间实现了更精细的权衡。然而,他们的算法使用了复杂的黑盒算法,使其不切实际。我们对实用的半流式 DFS 算法进行了实验分析。我们的分析涵盖了从真实图到随机图(均匀分布和幂律分布)的多种图类型。我们还提出了若干启发式方法来改进当前最先进的算法,并研究了它们的影响。我们的启发式方法将最先进算法的性能提升了 $40-90\\%$,在几乎 $40-50\\%$ 的情况下达到了最优的单次遍历(此前为零)。在随机图中,性能提升幅度为 $30-90\\%$,即使在 $k$ 值非常小的情况下也能达到最优的单次遍历。总体而言,我们的启发式方法显著改进了相对复杂的最先进算法,在随机图的最坏情况下仅需两次遍历。此外,我们的启发式方法使得相对简单的算法即使在非常小的空间限制下也能实际可用,而这在之前是不切实际的。
英文摘要:
Depth first search is a fundamental graph problem having a wide range of applications. For a graph $G=(V,E)$ having $n$ vertices and $m$ edges, the DFS tree can be computed in $O(m+n)$ using $O(m)$ space where $m=O(n^2)$. In the streaming environment, most graph problems are studied in the semi-streaming model where several passes (preferably one) are allowed over the input, allowing $O(nk)$ local space for some $k=o(n)$. Trivially, using $O(m)$ space, DFS can be computed in one pass, and using $O(n)$ space, it can be computed in $O(n)$ passes. Khan and Mehta [STACS19] presented several algorithms allowing trade-offs between space and passes, where $O(nk)$ space results in $O(n/k)$ passes. They also empirically analyzed their algorithm to require only a few passes in practice for even $O(n)$ space. Chang et al. [STACS20] presented an alternate proof for the same and also presented $O(\sqrt{n})$ pass algorithm requiring $O(n~poly\log n)$ space with a finer trade-off between space and passes. However, their algorithm uses complex black box algorithms, making it impractical. We perform an experimental analysis of the practical semi-streaming DFS algorithms. Our analysis ranges from real graphs to random graphs (uniform and power-law). We also present several heuristics to improve the state-of-the-art algorithms and study their impact. Our heuristics improve state of the art by $40-90\%$, achieving optimal one pass in almost $40-50\%$ cases (improved from zero). In random graphs, they improve from $30-90\%$, again requiring optimal one pass for even very small values of $k$. Overall, our heuristics improved the relatively complex state-of-the-art algorithm significantly, requiring merely two passes in the worst case for random graphs. Additionally, our heuristics made the relatively simpler algorithm practically usable even for very small space bounds, which was impractical earlier.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。