Very very Simple | C++ | BFS
Initialize the queue with the node currNode as k and store the corresponding time required in signal vector as 0. The signal from node currNode will travel to e
Initialize the queue with the node currNode as k and store the corresponding time required in signal vector as 0. The signal from node currNode will travel to every adjacent node. Iterate over every adjacent node neighborNode. We will add each adjacent node to the queue only if the signal from currNode via the current edge takes less time than the fastest signal to reach the adjacent node so far. Time taken by the fastest signal for currNode is denoted by signal[currNode]\n```\n        vector<vector<pair<int,int>>> vec(n+1);\n        \n        for(int i=0;i<times.size();i++){\n        \n           int j = times[i][0];\n           vec[j].push_back({times[i][1],times[i][2]}); \n        }\n        \n         vector<int> signal(n+1,INT_MAX);\n\n  queue<int> q;\n        q.push(k);\n        \n   \n        signal[k] = 0;\n        \n        while (!q.empty()) {\n            int currNode = q.front(); \n            q.pop();\n            \n       \n            for (pair<int,int> p : vec[currNode]) {\n                \n                \n                int time = p.second;\n                int neighbor = p.first;\n                \n                int arrival = signal[currNode] + time;\n                if (signal[neighbor] > arrival) {\n                    signal[neighbor] = arrival;\n                    q.push(neighbor);\n                }\n            \n            }\n        }\n        \n        int maxi = 0;\n        for(int i =1;i<=n;i++){\n            \n            if(signal[i]==INT_MAX)return -1;\n            \n            maxi = max(maxi,signal[i]);\n            \n        }\n                \n        return maxi;\n\n    }\n    \n```\n**Time complexity: O(N\u22C5E)\nSpace complexity: O(N\u22C5E)**
['Breadth-First Search']