Graph traversal is a technique to visit the each nodes of a graph G. It is also use to calculate the order of vertices in traverse process. We visit all the nodes starting from one node which is connected to each other without going into loop.
The graph has two types of traversal algorithms. These are called the Breadth First Search and Depth First Search
BFS stands for Breadth First Search. DFS stands for Depth First Search. Technique. It a vertex-based technique to find the shortest path in a graph. It is an edge-based technique because the vertices along the edge are explored first from the starting to the end node.
A graph can be represented by one of three data structures: an adjacency matrix, an adjacency list, or an adjacency set. An adjacency matrix is similar to a table with rows and columns. The nodes of a graph are represented by the row and column labels.
BFS stands for Breadth First Search. DFS stands for Depth First Search. 2. BFS(Breadth First Search) uses Queue data structure for finding the shortest path. DFS(Depth First Search) uses Stack data structure