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

Function initGraph

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

Source from the content-addressed store, hash-verified

17};
18
19var initGraph = (n, k) => ({
20 graph: Array.from({ length: n + 1 })
21 .fill()
22 .map(() => []),
23 maxTime: Array.from({ length: n + 1 }).fill(Infinity),
24 queue: new Queue([[k, 0]]),
25});
26
27var buildGraph = (times, n, k) => {
28 const { graph, maxTime, queue } = initGraph(n, k);

Callers 1

buildGraphFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected