MCPcopy
hub / github.com/TheAlgorithms/TypeScript / gatherScc

Function gatherScc

graph/kosajaru.ts:37–52  ·  view source on GitHub ↗
(
  graph: number[][],
  visited: boolean[],
  node: number,
  scc: number[]
)

Source from the content-addressed store, hash-verified

35
36// Computes the SCC that contains the given node
37const gatherScc = (
38 graph: number[][],
39 visited: boolean[],
40 node: number,
41 scc: number[]
42) => {
43 if (visited[node]) {
44 return
45 }
46 visited[node] = true
47 scc.push(node)
48
49 for (const dest of graph[node]) {
50 gatherScc(graph, visited, dest, scc)
51 }
52}
53
54/**
55 * @function kosajaru

Callers 1

kosajaruFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected