Graph Traversal Methods
There are two possible traversal methods for a graph:
i. Breadth-First Traversal
ii. Depth-First Traversal
i. Breadth-First Traversal: Traverse all the vertices starting from a given ‘start vertex’. Hence, such a traversal follows the ‘neighbour-first’ principle by considering the following:
- No vertex is visited more than once
- Only those vertices that can be reached are visited
Importantly here, we make use of the Queue data structure. In effect, we house the vertices in the queue that are to be visited soon in the order which they are added to this queue i.
[Read More]