Traversal of a graph is different from tree because

**(A)** There can be a loop in graph so we must maintain a visited flag for every vertex

**(B)** DFS of a graph uses stack, but inorrder traversal of a tree is recursive

**(C)** BFS of a graph uses queue, but a time efficient BFS of a tree is recursive.

**(D)** All of the above

**Answer:** **(A)** **Explanation:** See https://www.geeksforgeeks.org/depth-first-traversal-for-a-graph/

Quiz of this Question

## Recommended Posts:

- Algorithms | Graph Traversals | Question 1
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 9
- Algorithms | Graph Traversals | Question 8
- Algorithms | Graph Traversals | Question 9
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 12
- Algorithms | Graph Traversals | Question 12
- Maximum cost path in an Undirected Graph such that no edge is visited twice in a row
- Edge Coloring of a Graph
- Minimum number of edges between two vertices of a graph using DFS
- Print the lexicographically smallest BFS of the graph starting from 1
- Print the lexicographically smallest DFS of the graph starting from 1
- Check if a directed graph is connected or not
- Count total ways to reach destination from source in an undirected Graph
- Count of unique lengths of connected components for an undirected graph using STL
- Nodes with prime degree in an undirected Graph