This function is customized for the "shortestPathDAG" fuction
| 264 | |
| 265 | // This function is customized for the "shortestPathDAG" fuction |
| 266 | void findTopoSortDFS2(int node, vector<pair<int, int>> arr[], stack<int> &s, vector<int> &vis) |
| 267 | { |
| 268 | vis[node] = 1; |
| 269 | for (auto i : arr[node]) |
| 270 | { |
| 271 | if (!vis[i]) |
| 272 | { |
| 273 | findTopoSortDFS2(i.first, arr, s, vis); |
| 274 | } |
| 275 | } |
| 276 | s.push(node); |
| 277 | } |
| 278 | |
| 279 | // shortest path in weighted DAG(Directed Acyclic Graph) |
| 280 | void shortestPathDAG(vector<pair<int, int>> arr[], int n, int source) |