---
title: "Discussion on \"Depth First Search (DFS) Traversal: for Undirected Unweighted Graph\" | Hashnode"
description: "Discussion on \"Depth First Search (DFS) Traversal: for Undirected Unweighted Graph\". DFS Traversal — 4 Easy Rules\nRule 1 — Start\n\nPut the starting vertex into a stack\n\nKeep an empty visited set\n\n\nstack.push(start);\nSet<Integer> visited = new HashSet<>();\n\n\nRule 2 — Take from Stack\nWhile the stack is not empty:\n\nPop the top vertex fro..."
url: "https://hashnode.com/posts/dfs-traversal-for-undirected-unweighted-graph/695c787fc30bb3b03ec6562c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Depth First Search (DFS) Traversal: for Undirected Unweighted Graph](https://dsa-3956.hashnode.dev/dfs-traversal-for-undirected-unweighted-graph?utm_source=hashnode&utm_medium=feed)

DFS Traversal — 4 Easy Rules Rule 1 — Start Put the starting vertex into a stack Keep an empty visited set stack.push(start); Set<Integer> visited = new HashSet<>(); Rule 2 — Take from Stack While the stack is not empty: Pop the top vertex fro...

Jan 6 · 7 min read · dsa-3956.hashnode.dev  
Read the article

-   [#dfs](https://hashnode.com/tag/dfs)
-   [#graph](https://hashnode.com/tag/graph)
-   [#datastructure](https://hashnode.com/tag/datastructure)
-   [#datastructuresandalogrithm](https://hashnode.com/tag/datastructuresandalogrithm)
-   [#java](https://hashnode.com/tag/java)
-   [#backtracking](https://hashnode.com/tag/backtracking)

## Written by

[Bikash Mainali](https://hashnode.com/@bikash8848)

@bikash8848

  
[View profile](https://hashnode.com/@bikash8848)

Software Engineer

Experienced Java/JavaScript full-stack developer over 6 years of extensive expertise serving key role on elite technical teams developing enterprise software for healthcare, apple ad-platform, banking, and e-commerce. Adaptable problem-solver with high levels of skill in Groovy, Java, Spring, Spring Boot, Hibernate, JavaScript, TypeScript, Angular, Node, Express, React, MongoDB, IBM DB2, Oracle, PL/SQL, Docker, Kubernetes, CI/CD pipelines, AWS, Micro-service and Agile/Scrum. Strong technical skills paired with business-savvy UI design expertise. Personable team player with experience collaborating with diverse cross-functional teams.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
