Explain BFS and DFS in terms of backtracking

Wikipedia on depth First search:

Depth Search (DFS) is an algorithm for moving or searching a tree, tree structure or graph. One starts with the root (selecting some node as the root in the case of the graph) and examines, as far as possible, along each branch before retreating.

So what is the first Breadth search?

"the algorithm that the node selects, checks all the backtracks nodes, selects the shortest path, selects the neighboring backtracks nodes, selects the shortest path, finally finds the optimal path due to the intersection of each path due to the continuity of returns.

Regex find cropping - trackback?

The term backtracking is confusing due to its variety of uses. UNIX find trimming SO user explained by backtracking. Regex Buddy uses the term "catastrophic backtracking" if you do not limit the scope of your regular expressions. This seems like an overly widely used umbrella term. So:

  • How do you define β€œbacktracking” specifically for graph theory?
  • What is backtracking in Breadth First Search and Depth First Search?

[Added]

Good back tracking definitions and examples

+5
graph breadth-first-search depth-first-search backtracking
Apr 25 '10 at 16:57
source share
1 answer

The confusion comes because backtracking is what happens during the search, but it also refers to a specific problem-solving technique that does a lot of backtracking. Such programs are called backtrackers.

The image moving in the neighborhood, always making the first turn that you see (let's say that there is no loop), until you reach a dead end, and at that moment you will return to the intersection of the next invisible street. This is the "first" type of backtracking, and it is roughly equivalent to the spoken word exploitation.

A more specific use relates to a problem-solving strategy, which is similar to a depth search, but goes back when he realizes that it is not worth continuing down a subtree.

Take a different path - naive DFS blindly visits each node until it reaches the goal. Yes, he "retreats" to the leaf nodes. But backtracker also lags behind useless branches. One example is finding a Boggle board for words. Each tile is surrounded by 8 others, so the tree is huge, and naive DFS can take too much time. But when we see a combination of the type "ZZQ", we can safely stop the search from this point, since adding more letters will not make this word.

I like these lectures by Professor Julie Zelensky. She solves 8 queens, a sudoku puzzle and a slow-change puzzle using reverse tracing, and everything is beautifully animated. Programming of abstractions, lecture 10 Programming of abstractions, lecture 11

A tree is a graph where any two vertices have only one path between them. This eliminates the possibility of cycles. When you are looking for a schedule, you will usually have some logic to eliminate loops anyway, so the behavior will be the same. In addition, using a directed graph, you cannot follow edges in the β€œwrong” direction.

From what I can tell, in the Stallman newspaper, they developed a logical system that not only says yes or no in the request, but actually offers corrections for incorrect requests by making the least number of changes. You can see where the first countdown can begin.

+11
Jul 01 '10 at 8:41
source share



All Articles