algorithms
Graph
Breadth First Search (BFS)
Use the queue data structure to hold each vertex that needs to be visited in the future.
It should keep a visited data structure to store all the visited vertices.
Runtime: O(V+E) / V = vertices
E = edges.
Depth First Search (DFS)
Use the stack data structure or do recursive.
It should keep a visited data structure to store all the visited vertices.
Runtime: O(V+E) / V = vertices
E = edges.