MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / buildGraph

Function buildGraph

javascript/0743-network-delay-time.js:27–37  ·  view source on GitHub ↗
(times, n, k)

Source from the content-addressed store, hash-verified

25});
26
27var buildGraph = (times, n, k) => {
28 const { graph, maxTime, queue } = initGraph(n, k);
29
30 for (const [src, dst, weight] of times) {
31 graph[src].push([dst, weight]);
32 }
33
34 maxTime[0] = 0;
35
36 return { graph, maxTime, queue };
37};
38
39var bfs = (queue, graph, maxTime) => {
40 while (!queue.isEmpty()) {

Callers 1

networkDelayTimeFunction · 0.70

Calls 2

initGraphFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected