You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- We first create the graph out of the given array of edges using an `Object`.
39
+
- We then run the `DFSGraphTraversal` function to execute the depth first search.
40
+
- In the function, we have three parameters; namely the `graph`, the `start` node and the `visited` set which is empty by default.
41
+
- Firstly, we print the `start` node and then we add the node to the `visited` set.
42
+
- We then run a for loop for the elements present in the `graph[start]` array.
43
+
- If the current element is not present in the `visited` set, then recursively call the `DFSGraphTraversal` function with the same `graph` and `visited` set, but with the current element as the `start` node.
44
+
- This function will run until all the nodes are visited in the `graph`.
45
+
46
+
## References
47
+
48
+
-[Youtube](https://youtu.be/IG1ABs6lVMw)
49
+
50
+
## Problem Added By
51
+
52
+
-[khairalanam](https://github.com/khairalanam)
53
+
54
+
## Contributing
55
+
56
+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
0 commit comments