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

Function bfs

javascript/0743-network-delay-time.js:39–45  ·  view source on GitHub ↗
(queue, graph, maxTime)

Source from the content-addressed store, hash-verified

37};
38
39var bfs = (queue, graph, maxTime) => {
40 while (!queue.isEmpty()) {
41 for (let level = queue.size() - 1; 0 <= level; level--) {
42 checkNeighbors(queue, graph, maxTime);
43 }
44 }
45};
46
47var checkNeighbors = (queue, graph, maxTime) => {
48 const [node, time] = queue.dequeue();

Callers 1

networkDelayTimeFunction · 0.70

Calls 3

checkNeighborsFunction · 0.70
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected