Skip to content

Commit b6a8bdb

Browse files
committed
renamed dfs.md as readme.md and added gif
1 parent f338c81 commit b6a8bdb

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Competitive Coding/Graphs/Graph_Search/DepthFIrstSearch/DFS.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Depth-first search (DFS)
2+
An algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking
3+
4+
----
5+
![](https://upload.wikimedia.org/wikipedia/commons/7/7f/Depth-First-Search.gif)
6+
----
7+
This is the algorithm for Depth First Search in a given graph.
8+
9+
* We take a starting vertex , and push all its adjacent vertexes in a stack.
10+
* Now we pop an element from a stack and push all its vertexes in the stack , and we also mark down these vertexes as visited.
11+
* After executing the code, we will get the vertex visited in a depth first manner.
12+
13+
[more info](https://en.wikipedia.org/wiki/Depth-first_search)

0 commit comments

Comments
 (0)