Determining the degree of inherent parallelism in classical sequential algorithms and leveraging it for fast parallel execution is a key topic in parallel computing, and detailed analyses are known for a wide range of classical algorithms. In this paper, we perform the first such analysis for the fundamental Union-Find problem, in which we are given a graph as a sequence of edges, and must maintain its connectivity structure under edge additions. We prove that classic sequential algorithms for this problem are well-parallelizable under reasonable assumptions, addressing a conjecture by [Blelloch, 2017]. More precisely, we show via a new potential argument that, under uniform random edge ordering, parallel union-find operations are unlikely to interfere: $T$ concurrent threads processing the graph in parallel will encounter memory contention $O(T^2 \cdot \log |V| \cdot \log |E|)$ times in expectation, where $|E|$ and $|V|$ are the number of edges and nodes in the graph, respectively. We leverage this result to design a new parallel Union-Find algorithm that is both internally deterministic, i.e., its results are guaranteed to match those of a sequential execution, but also work-efficient and scalable, as long as the number of threads $T$ is $O(|E|^{\frac{1}{3} - \varepsilon})$, for an arbitrarily small constant $\varepsilon > 0$, which holds for most large real-world graphs. We present lower bounds which show that our analysis is close to optimal, and experimental results suggesting that the performance cost of internal determinism is limited.
翻译:确定经典顺序算法中固有的并行度并利用其实现快速并行执行是并行计算中的关键课题,众多经典算法的详细分析已广为人知。本文首次对基础性的并查集问题开展此类分析:给定一个以边序列形式呈现的图,需在边添加过程中维护其连通性结构。我们证明,在合理假设下,该问题的经典顺序算法具有良好的可并行性,从而解决了Blelloch(2017年)提出的猜想。具体而言,通过一种新的势能论证,我们表明在均匀随机边序下,并行并查集操作不易相互干扰:并行处理该图的T个并发线程预期仅产生$O(T^2 \cdot \log |V| \cdot \log |E|)$次内存争用,其中$|E|$和$|V|$分别为图的边数和节点数。基于此结果,我们设计了一种新型并行并查集算法,该算法既具有内部确定性(即其结果保证与顺序执行结果一致),又具有工作高效性与可扩展性,前提是线程数T满足$T = O(|E|^{\frac{1}{3} - \varepsilon})$($\varepsilon > 0$为任意小常数),这一条件适用于大多数真实大规模图。我们提出的下界表明该分析接近最优,且实验结果提示内部确定性的性能代价有限。