高效生成素路径
Efficient Prime Paths Generation
AI总结:
本文提出基于强连通分量结构特征的素路径生成方法,通过约束环枚举减少计算开销,实现高效生成可行候选路径。
摘要:
素路径覆盖是一种强大的结构测试标准,但生成有向图中所有素路径仍具有计算挑战性,因为它们的数量可能呈指数级增长。现有方法通常依赖于枚举大量候选路径并过滤它们,导致高计算和内存开销。在本文中,我们提出了一种基于素路径在强连通分量结构特征的新方法。这种特征给出了有效路径端点的非平凡必要条件,并将问题转化为增强图中的受限环枚举。因此,我们避免显式枚举所有简单路径,而是只生成可行候选。基于这一洞察,我们设计了一种流算法,以增量方式输出素路径,利用Johnson式遍历作为子程序,在显著减少的搜索空间中进行。该算法利用SCC边界穿越作为自然剪枝检查点——在检测到部分路径被检测为可逆扩展时立即丢弃,从而在遍历过程中消除整个搜索空间的子树,而不是事后过滤完成的路径。我们实现了我们的方法,并在大量真实世界控制流图上进行了评估,这些图是从开源C++和Python项目中提取的。结果表明,我们的方法在性能上始终优于现有方法,同时在实践中保持稳定的输出延迟。
英文摘要:
Prime path coverage is a powerful structural testing criterion, but generating all prime paths in a directed graph remains computationally challenging due to the potentially exponential number of them. Existing approaches typically rely on enumerating large sets of candidate paths and filtering them, leading to high computational and memory overhead. In this paper, we present a new approach to prime path generation based on a structural characterization of prime paths in terms of strongly connected components. This characterization yields non-trivial necessary conditions for valid path endpoints and reduces the problem to constrained cycle enumeration in an augmented graph. As a result, we avoid explicitly enumerating all simple paths and instead generate only feasible candidates. Building on this insight, we design a streaming algorithm that outputs prime paths incrementally, using a Johnson-style traversal as a subroutine within a significantly reduced search space. The algorithm exploits SCC boundary crossings as natural pruning checkpoints - discarding partial paths the moment they are detected to be backward extendable, eliminating entire subtrees of the search space during traversal rather than filtering completed paths post hoc. We implement our method and evaluate it on a large dataset of real-world control-flow graphs extracted from open-source C++ and Python projects. The results demonstrate that our approach consistently outperforms existing methods, while maintaining stable inter-output delay in practice.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。