Are tree traversal algorithms basically backtracking? - algorithm

So I was doing some questions on backtracking and it suddenly hit me, that the implementation of depth first search is same as backtracking. Are they really the same or is my concept going wrong?

Related

How does the heuristic for an A* algorithm change the traversal

I am having some troubles understanding how the traversal of a graph will change from using a dikstras algorithm that will first look for the min value "road" to take to then go deeper into the tree.
How did the heuristic in a* cause a different traversal and overall different result
Well really appreciate a week constructed answer her because this is something I'm not really understand at this point.

BFS vs Heuristics

What is an example of Breadth First Search which still continues in real life example?
For example- I know that BFS is used in GPS navigations and digital maps, but A* is now used more often for better time complexity.
I am confused because BFS being a blind search technique, I think there will always be a heuristics beating it.
Also what are the circumstances under which BFS is unsuitable and a heuristic method is used?

Compared to other algorithms, what makes Depth-first Search a better solution for counting the number of connected-components in a graph?

I've looked for ways to count the no. of connected components online. I noticed that in most sites, the algorithm used is Depth-first search. I believe you can achieve the same thing Breadth-first search and union-find as well. So why do people prefer using DFS for finding number of connected components?
Mainly because of two reasons:
It's simple and short. No data structure is required (well we need a stack but recursion takes care of that)
It's memory friendly, Breath First Search has a memory complexity of O(V) (V is number of nodes). DFS on the other hand has O(h) (h is maximum depth of the recursion tree).
It is not better in terms of complexity, as in all cases you will visit a node exactly once. In terms of memory usage, you will always have to know what nodes were visited and what nodes were found and not visited yet. Depth-first will take a child node and visit its descendants before its siblings, while Breadth-first will visit the siblings before descendants. Depth-first is shorter and simpler and arguably more intuitive though, which could be the reason it is chosen in tutorials, books and presentation more frequently than the others.
In many cases the stack to be used is handled by recursion, but that is not necessarily a good idea, especially in the case of large graphs.

What are the practical uses of DFS and BFS?

I had this question asked in the interview today. I told them its traversal and DFS can be used to see if the graph is connected. They said it was too simple.
What are some more important practical uses of DFS and BFS?
On a lighter note. This always comes to my mind when I hear DFS or BFS.
Note: This does not provide the direct answer to your question.
BFS :
Minimum Spanning Tree or shortest path
Peer to peer networking
Crawler for search engine
Social network websites - to find people with a given distance k from a person using BFS till k levels.
DFS :
Minimum Spanning Tree
Topological sorting
To solve puzzle/maze which has one solution
Here some points which come in my mind while reading your question:
DFS:
not usable on infinite trees (because you might go down an infinite branch). Or if there are cycles in your search graph you must take precaution to avoid running in a cycle forever.
you will most likely not find the nearest solution first
you need only O(depth) memory
BFS
the first solution you find is one of the nearest ones
you will need quite a lot of memory, because the search tree might get very broad already at quite little depth.
works on infinite trees and cyclic structures without any precaution
Of cause you will find much more on wikipedia
BFS
DFS

Graph Search algorithms vs. graph optimization

I have been looking at a lot of graph searches -both informed and uninformed. I have also looked at and coded some optimization problems such as hill-climbing. My question is, how can I relate the two types of algorithms?
To be a little more clear, here is an example:
Let's say I run a graph algorithm like Depth first Iterative Deepening. I run it for one depth and get a goal node, then I run it again at a different depth and find a goal node and so on. So now, I have a set of possible goal nodes. Could I run an optimization algorithm like hill climbing to find which one is "optimal" according to different limitations?
One of the notions you encounter in graph search algorithms is optimality. You should consider that here optimality is just about the algorithm and not about the goal. Meaning that, if an algorithm is optimal it should return the minimum cost solution.
Now, if you want to optimize something it's completely a different problem. In this case the quality of the solution is of most importance not the way you achieve it.
Algorithms like Genetic Algorithms, PSO, ... and many more optimization methods exists to address this issue.
BTW, sometimes we combine a graph search method like A* with an optimization algorithm to gain better results from the optimization algorithm.
Note: The term Graph Optimization is not related to the topic Graph Search that I think is your main topic according to your question.

Resources