MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / buildGraph

Function buildGraph

javascript/0210-course-schedule-ii.js:24–36  ·  view source on GitHub ↗
(numCourses, prerequisites)

Source from the content-addressed store, hash-verified

22});
23
24var buildGraph = (numCourses, prerequisites) => {
25 const { graph, color, isDirectedAcyclicGraph, topologicalOrder } =
26 initGraph(numCourses);
27
28 for (const [src, dst] of prerequisites) {
29 const neighbors = graph[dst] || [];
30
31 neighbors.push(src);
32 graph[dst] = neighbors;
33 }
34
35 return { graph, color, isDirectedAcyclicGraph, topologicalOrder };
36};
37
38var search = (
39 numCourses,

Callers 1

findOrderFunction · 0.70

Calls 2

initGraphFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected