Skip to content

Commit bf4ae8b

Browse files
authored
Update DFS.PY
1 parent 3db825c commit bf4ae8b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Data Structures/Graphs/DFS.PY

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# DFS Traversal of Graph using Adjacency Matrix Representation
2+
# Function To implement DFS (Depth First Search)
13
def Depthfirstsearch(matrix,start):
24
visit=[start] #Keep Track of Visited elements
35
stack=[start] #DFS is implemented using stack
@@ -30,4 +32,4 @@ if __name__ == "__main__":
3032
start=int(input("Enter the starting vertix\n"))
3133
ans=Depthfirstsearch(matrix,start)
3234
print("DFS of the given graph is ",end=" ")
33-
print(*ans)
35+
print(*ans)

0 commit comments

Comments
 (0)