Inscrit le: 01 Oct 2017
|Posté le: Mer 13 Déc - 13:28 (2017) Sujet du message: Searching a Graph Depth-First
|The main strategy of this algorithm (as it can be seen from its name) is going in depth while it is possible. I think that it is easier to understand recursive implementation of DFS, so here it is. Imagine that DFS–function is called from vertex v. What do we do is just go through all its neighbors, which we haven’t visited, and call DFS from each of them recurrently one after another. For example, if vertices are people and relations between vertices are father-son relations between people: let’s imagine that DFS is called from my grandfather. We call DFS from his first son (my father) then, we do the same with my father and call DFS from me. As I don’t have children, we do a step back to my father and call DFS from his second son (my brother). As you can see we went down from grandfather to me – to the depth. And if we can’t go deeper, we go one step back (using return from function).
I didn't find the right solution from the internet.
Email Marketing Examples