Depth-First Search

Take a look at the wikipedia: http://en.wikipedia.org/wiki/Depth-first_search

DFS Implementation (Recursive)
http://www.shawonruet.com/2017/06/dfs-recursion.html

DFS Implementation (Stack)
http://www.shawonruet.com/2019/03/depth-first-search-dfs-by-stack-in-c.html