Question: 1. For the digraph given, implement the pseudo algorithms of Breadth-First Search (Traversal) and Depth-First Search (Traversal) in Java or C++. Your implementation should follow
1. For the digraph given, implement the pseudo algorithms of Breadth-First Search (Traversal) and Depth-First Search (Traversal) in Java or C++. Your implementation should follow the pseudocode provided in the lecture and also as shown below. Use your variables in the implementation. Each must be a separate method. Do not copy somebody else's code.
To complete and test the implementation, you will need to:
a. Make an adjacency-list or adjacency-matrix to save information about nodes and edges.
b. Display the results in the sequence of each of the nodes traversed based on the search (traversal) algorithm.
The only acceptable answers are Java or C++ source code algorithms that work based on the pseudo code in the image below.

breadthFirstsearch() for all vertices u num(u)-0; edges-null; while there is a vertex v such that num(v)0 num (v)-1++; enqueue (V); while queue is not empty v = dequeue( ) ; for all vertices u adjacent to v DES (v) nian (v) = 1++ ; for all vertices u adjacent to v if num(u) is 0 if num (u) is 0 attach edge (uv) to edges enqueue (u); attach edge (vu) DFS (u) to edges; output edges; depthFirstsearch () for all vertices v num (v)0 while there is a vertex v such that num (v) is 0 DFS (v) output edges
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
