Given a graph with N nodes and M directed edges. Your task is to complete the function kosaraju() which returns an integer denoting the number of strongly connected components in the graph.
The first line of input contains an integer T. Then T test cases follow. Each test case contains two integers N and M . In the next line are M space separated values u,v denoting an edge from u to v.
For each test case in a new line output will an integer denoting the no of strongly connected components present in the graph.
Since this is a functional problem you don't have to worry about input, you just have to complete the function kosaraju().
1 <= T <= 100
1 <= N,M <= 100
1 <= u,v <= N
1 0 0 2 2 1 0 3 3 4
0 1 1 2 2 0
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.