depth_first_traversal

  • Starts at the root node and explores as far as possible along each branch before backtracking.
  • Moved to the adjacent unmarked node and continue this loop until there is no unmarked adjacent nodes.
  • Then backtrack and check for other unmarked nodes and traverse them.
  • Time complexity: O(V + E), where V is the number of vertices and E is the number of edges in the graph.