Breadth-First Search(BFS): BFS is a graph algorithm that explores the closest nodes first. Therefore, it's commonly used to find the shortest path between a starting node and an ending node. The time complexity of BFS is O(|V| + |E|) where V is the number of nodes and E is the number of edges, since every node and every edge will be visited in the worse case.
Input Explanations:
1. starting node: The starting node to begin the traversal
2. ending node: This is an optional input. If this is specified DFS will try to find a path between the starting node and ending node