迭代深化深度优先搜索 (iterative deepening depth-first search (IDS or IDDFS)))是对状态空间的搜索策略。它重复地运行一个有深度限制的深度优先搜索,每次运行结束后,它增加深度并迭代,直到找到目标状态。

IDDFS 与广度优先搜索有同样的时间复杂度,而空间复杂度远优。

IDDFS 第一次访问节点的累积顺序是广度优先的。

例子

1

走这张图

深度0

A,没了

深度1

ABCE,没了

深度2

A, B, D, F,

这时该往回走

C, G, E,完了, F(F撞了)

深度3

A, B, D, F, E,

这时该往回走

C, G,完了, E, F, B(这三个撞了)

算法

以下虚拟码展示了由递归地使用限制深度的 DFS (深度优先搜索) 算法来实现的 IDDFS 算法 (叫作 DLS).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
procedure IDDFS(root)
for depth from 0 to ∞
found ← DLS(root, depth)
if found ≠ null
return found

procedure DLS(node, depth)
if depth = 0 and node is a goal
return node
else if depth > 0
foreach child of node
found ← DLS(child, depth−1)
if found ≠ null
return found
return null

原文地址:
https://zh.wikipedia.org/wiki/%E8%BF%AD%E4%BB%A3%E6%B7%B1%E5%8C%96%E6%B7%B1%E5%BA%A6%E4%BC%98%E5%85%88%E6%90%9C%E7%B4%A2

知识共享 署名-相同方式共享 3.0协议之条款下提供