![]() Since 0 has already been visited, we visit 2 instead. Next, we visit the element at the top of stack i.e. Visit the element and put it in the visited list We start from vertex 0, the DFS algorithm starts by putting it in the Visited list and putting all its adjacent vertices in the stack. We use an undirected graph with 5 vertices. Let's see how the Depth First Search algorithm works with an example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |