Search Flashcards
Describe a simple search agent.
Deterministic, goal-driven agent.
What is a solution to a problem given a set of start nodes and goal nodes?
A path from a start node to a goal node.
What is the forward branching factor of a node?
It is the number of arcs going out of the node.
What is the backward branching factor of a node?
It is the number of arcs going into the node
Describe generic search algorithm.
- Given a graph, start nodes, and goal nodes, incrementally explore paths from start node.
- Maintain a frontier of paths from the start node that have been explored.
- As search proceeds, the forntier expands the unexplored nodes until a goal node is encountered.
What does it mean for a search algorithm to be complete?
A search algorithm is complete of whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time.
What does it mean for a search algorithm to be optimal?
A search algorithm is optimal if when it finds a solution, it is the best one.
What is the time complexity of a search algorithm?
The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of:
- maximum path length m
- maximum branching factor b
What is the time complexity of a search algorithm?
The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use, expressed in terms of:
- maximum path length m
- maximum branching factor b
What does define the search strategy?
The way in which the frontier is expanded defines the search strategy.
What is frontier?
Frontier is the set of paths which could be xplored next.
Define depth-first search.
Depth-first search is a search algorithm that explores each path on the frontier until its end (or until a goal is found) before considering any other path.
What is the frontier in DFS?
In DFS, the frontier is a last-in-first-out stack.
Is DFS complete?
No, it may stuck in infinite loops.
Is DFS optimal?
No, it can “stumble” on longer solution paths before it gets to shorter ones.
What is the time complexity of DFS?
DFS time complexity is O(b^m). Must examine every node in the tree
What is the space complexity of DFS?
DFS space complexity is O(bm). The longest possible path is m, and for every node in that path must maintain a fringe of size b.
When DFS is complete?
DFS is complete for finite acyclic graphs
When is using DFS appropriate?
DFS is appropriate when:
- Space restricted
- Many solutions, with long path length
When is using DFS unappropriate?
DFS is a poor method when:
- There are cycles in the graph
- There are sparse solution at shallow depth
Define breadth-first search.
Breadth-first search is a search algorithm that explores all paths of legth l on the frontier, before looking at path of length l+1
What is the frontier in BFS?
In BFS, the forntier is a first-in-first-out queue.
Is BFS complete?
BFS is complete. If a solution exists at level l, the path to it will be explored before any other path of length l+1.
Is BFS optimal?
Yes. Any goal at level l will be reached before goals at lower levels.