| 156 | } |
| 157 | |
| 158 | void findTopoSortDFS(int node, vector<int> arr[], stack<int> &s, vector<int> &vis) |
| 159 | { |
| 160 | vis[node] = 1; |
| 161 | |
| 162 | for (auto i : arr[node]) |
| 163 | { |
| 164 | if (!vis[i]) |
| 165 | { |
| 166 | findTopoSortDFS(i, arr, s, vis); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | s.push(node); |
| 171 | } |
| 172 | |
| 173 | vector<int> topoSortDFS(vector<int> arr[], int n) |
| 174 | { |