Graph: Depth-first Search
Skip to content
Explore
When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.
a poster with different types of text and pictures on the back ground, including an image of

More about this Pin

Board containing this Pin

Selected board cover image
Bit's and FLOPS
69 Pins
2w

Related interests

Being Used
Coding
Bring It On

Graph: Depth-first Search

Depth-first search (DFS) is a fundamental search algorithm that is used to traverse graphs or trees. It explores a path as deep as possible and backtracks when it hits a dead end. In this post, we review the DFS and implement it in both recursive and iterative versions. We test both versions with a given graph. Moreover, we bring the Python code to find a path between two nodes. The complete Python code is available at the mentioned GitHub page, which also includes the code to find all paths between two nodes .
ostad.ai avatar link
ostad.ai

Comments