Question: CS3353 Data Structures and Algorithm Analysis I Programming Assignment - may be written in c, c++, or java Implement the BFS (Breadth First Search) and
CS3353 Data Structures and Algorithm Analysis I Programming Assignment - may be written in c, c++, or java Implement the BFS (Breadth First Search) and DFS (Depth First Search) Algorithms we covered in class, then topological sort and SCC. Input: take an input graph (directed acyclic graph) in the form of adjacency matrix. 1 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 (*notice that the values are arbitrary, just refer to the format) Output: record and maintain the information of vertices and edges in the adjacency matrix in which each coordinate should contain the following information: 1. BFS: distance from the source on each vertex on the row once the algorithm completed 3 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 4 (*notice that the vlues are arbitrary, just refer to the format) (*if you prefer, you may output just in a linear array such as 3 2 1 0 4, but nxn matrix is a more efficient format for debugging and tracing purpose)) 2. DFS: (discovery time/finish time) (1/8) 0 0 0 0 0 (2/7) 0 0 0 0 0 (3/6) 0 0 0 0 0 (4/5) 0 0 0 0 0 (9/12) (*notice that the vlues are arbitrary, just refer to the format) (*if you prefer, you may output just in a linear array such as 1/8 2/7 3/6 4/5 9/12, but nxn matrix is a more efficient format for debugging and tracing purpose)) 3. Implement topological sort. Input: the output from the above DFS Output: a list of nodes sorted in non-decreasing order 4. Implement strongly connected components Input: the output from the above DFS Output: a topologically sorted list of nodes per component in a non-decreasing order by the number of nodes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
