提交 6a27355d authored 作者: Frederic Bastien's avatar Frederic Bastien 提交者: Reyhane Askari

Add docstring/comments

上级 bec57f6e
...@@ -608,6 +608,8 @@ def stack_search(start, expand, mode='bfs', build_inv=False): ...@@ -608,6 +608,8 @@ def stack_search(start, expand, mode='bfs', build_inv=False):
expand : callable expand : callable
When we get to a node, add expand(node) to the list of nodes to visit. When we get to a node, add expand(node) to the list of nodes to visit.
This function should return a list, or None. This function should return a list, or None.
mode : string
'bfs' or 'dfs' for breath first search or depth first search.
Returns Returns
------- -------
...@@ -632,7 +634,7 @@ def stack_search(start, expand, mode='bfs', build_inv=False): ...@@ -632,7 +634,7 @@ def stack_search(start, expand, mode='bfs', build_inv=False):
start_pop = start.popleft start_pop = start.popleft
else: else:
start_pop = start.pop start_pop = start.pop
expand_inv = {} expand_inv = {} # var: clients
while start: while start:
l = start_pop() l = start_pop()
if id(l) not in rval_set: if id(l) not in rval_set:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论