| 55 | } |
| 56 | |
| 57 | void dfs(vector<int> transpose[], int source, vector<bool> &visited) |
| 58 | { |
| 59 | cout << source << " "; |
| 60 | visited[source] = true; |
| 61 | for (int i = 0; i < transpose[source].size(); i++) |
| 62 | { |
| 63 | int adjacent = transpose[source][i]; |
| 64 | if (visited[adjacent] == false) |
| 65 | { |
| 66 | dfs(transpose, adjacent, visited); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void kosaraju(vector<int> vec[], int v, vector<int> transpose[]) |
| 72 | { |