c++ solution | BFS
\nclass Solution {\npublic:\n    int networkDelayTime(vector<vector<int>>& times, int n, int k) {\n        int size=times.size();\n        int max_time=0, des, 
```\nclass Solution {\npublic:\n    int networkDelayTime(vector<vector<int>>& times, int n, int k) {\n        int size=times.size();\n        int max_time=0, des, time; \n        vector<pair<int,int>>graph[n+1];\n        vector<int> t(n+1,INT_MAX);\n        \n        for(int i=0;i<size;i++){\n            graph[times[i][0]].push_back({times[i][1],times[i][2]});\n        }\n\n        queue<pair<int,int>> q;\n        q.push({k,0});\n        \n        while(!q.empty()){\n                pair<int,int>p = q.front(); \n                q.pop();\n                des=p.first;\n                time=p.second;\n                t[des]=min(t[des],time);\n                for(auto x : graph[des]){\n                    if(x.second+time < t[x.first]) q.push({x.first,(x.second+time)});\n                }     \n        }\n        \n        for(int i=1;i<n+1;i++){\n            if(t[i]==INT_MAX) return -1;\n            max_time=max(max_time,t[i]);\n        }\n        return max_time;\n    }\n};\n```\nPlease **UPVOTE**
['Breadth-First Search', 'C']