MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / findPath_list

Function findPath_list

code/solutions/22_3_optimizing.js:31–43  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

29}
30
31function findPath_list(a, b) {
32 let work = [{at: a, via: null}];
33 let reached = new Set([a]);
34 for (let path of work) {
35 if (path.at == b) return pathToArray(path);
36 for (let next of path.at.edges) {
37 if (!reached.has(next)) {
38 reached.add(next);
39 work.push({at: next, via: path});
40 }
41 }
42 }
43}
44
45time(findPath_list);

Callers

nothing calls this directly

Calls 3

pathToArrayFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected