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

Function initGraph

javascript/0210-course-schedule-ii.js:17–22  ·  view source on GitHub ↗
(numCourses)

Source from the content-addressed store, hash-verified

15};
16
17var initGraph = (numCourses) => ({
18 graph: new Array(numCourses).fill().map(() => []),
19 color: new Array(numCourses).fill(1), // White
20 isDirectedAcyclicGraph: [true],
21 topologicalOrder: [],
22});
23
24var buildGraph = (numCourses, prerequisites) => {
25 const { graph, color, isDirectedAcyclicGraph, topologicalOrder } =

Callers 1

buildGraphFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected