Bfs
Breadth-first search traversal.
BFSTraversal
Bases: TraversalStrategyABC
Breadth-first traversal policy.
search
search(
*,
tree: ConfigurationTree,
generator: MoveGenerator,
goal: GoalPredicate,
max_expansions: int | None = None,
max_depth: int | None = None
) -> SearchResult
Execute search over the tree using the supplied generator.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/search/traversal/bfs.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
bfs
bfs(
tree: ConfigurationTree,
generator: MoveGenerator,
goal: GoalPredicate,
max_expansions: int | None = None,
max_depth: int | None = None,
) -> SearchResult
Breadth-first search.
Explores nodes level by level (shortest path first). Guarantees finding the shallowest goal if one exists within the depth limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree
|
ConfigurationTree
|
The configuration tree to search. |
required |
generator
|
MoveGenerator
|
Move generator for producing candidates. |
required |
goal
|
GoalPredicate
|
Predicate that returns True for goal configurations. |
required |
max_expansions
|
int | None
|
Maximum nodes to expand. None means no limit. |
None
|
max_depth
|
int | None
|
Maximum depth to explore. None means no limit. |
None
|
Returns:
| Type | Description |
|---|---|
SearchResult
|
SearchResult with the goal node (or None if not found). |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/search/traversal/bfs.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |