How gustavofelipem/search_lib works
search_lib is a Python library for exploring state spaces with interchangeable search strategies. A caller supplies an initial state and a problem; a strategy checks goal states, asks the problem for actions, applies valid actions, and builds search nodes in its frontier. It returns a solution node and search metrics, with parent links supporting path reconstruction. The documented extension points include additional problems and algorithms; the sampled implementation contains tree-search BFS, DFS, and depth-limited DFS. The grid example is not mapped because its source was not sampled.
Main entry points: bfs_tree.py BFS · dfs_tree.py DFS · dls_tree.py Depth-Limited DFS · core.py Search Node
Components 13
Search Runtime
- Strategy Base
search_lib/core.py - Search Node
search_lib/core.py - Search Metrics
search_lib/core.py - Search Result
search_lib/core.py - Search Callbacks
search_lib/core.py
Tree Algorithms
- BFS
search_lib/algorithms/bfs_tree.py - DFS
search_lib/algorithms/dfs_tree.py - Depth-Limited DFS
search_lib/algorithms/dls_tree.py
Other components
- Library Caller
- Public API
search_lib/__init__.py
Connections 32
- Library Caller → Public API: imports
- Library Caller → BFS: selects strategy
- Library Caller → DFS: selects strategy
- Library Caller → Depth-Limited DFS: selects strategy
- Library Caller → Problem: provides problem
- Library Caller → State: provides initial state
- Strategy Base → Problem: stores problem
- BFS → Strategy Base: extends
- DFS → Strategy Base: extends
- Depth-Limited DFS → Strategy Base: extends
- BFS → Problem: checks goal; gets actions
- DFS → Problem: checks goal; gets actions
- Depth-Limited DFS → Problem: checks goal; gets actions
- BFS → Action: applies actions
- DFS → Action: applies actions
- Depth-Limited DFS → Action: applies actions
- BFS → Search Node: creates frontier nodes
- DFS → Search Node: creates frontier nodes
- Depth-Limited DFS → Search Node: creates frontier nodes
- BFS → Search Metrics: updates metrics
- DFS → Search Metrics: updates metrics
- Depth-Limited DFS → Search Metrics: updates metrics
- BFS → Search Callbacks: dispatches events
- DFS → Search Callbacks: dispatches events
- Depth-Limited DFS → Search Callbacks: dispatches events
- BFS → Search Result: returns result
- DFS → Search Result: returns result
- Depth-Limited DFS → Search Result: returns result
- Search Node → State: represents
- Search Node → Action: records generating action
- Search Node → Search Node: links parent
- Library Caller → Search Result: receives