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

Function dfs

javascript/0210-course-schedule-ii.js:52–65  ·  view source on GitHub ↗
(node, graph, color, topologicalOrder, isDirectedAcyclicGraph)

Source from the content-addressed store, hash-verified

50};
51
52var dfs = (node, graph, color, topologicalOrder, isDirectedAcyclicGraph) => {
53 const hasCycle = !isDirectedAcyclicGraph[0];
54 if (hasCycle) return;
55
56 colorBackTrack(
57 node,
58 graph,
59 color,
60 topologicalOrder,
61 isDirectedAcyclicGraph,
62 );
63
64 topologicalOrder.push(node);
65};
66
67const colorBackTrack = (
68 node,

Callers 2

searchFunction · 0.70
checkNeighborsFunction · 0.70

Calls 2

colorBackTrackFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected