Here we will study different ways of visiting the vertices of a graph following their relations. This will be useful when we are designing algorithms that work with the data in the graph and require following a strict pattern when visiting the vertices.
BFS is a graph traversal algorithm that explores the neighbor vertices first, before moving to the next level neighbors.
DFS is a graph traversal algorithm that visits all vertices down a branch and then backtracks to neighbors.