MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / dfs

Method dfs

graph/kosaraju.go:83–92  ·  view source on GitHub ↗

Helper DFS function used in the transposed graph to collect SCCs.

(v int, visited []bool, scc *[]int)

Source from the content-addressed store, hash-verified

81
82// Helper DFS function used in the transposed graph to collect SCCs.
83func (g *Graph) dfs(v int, visited []bool, scc *[]int) {
84 visited[v] = true
85 *scc = append(*scc, v)
86
87 for neighbor := range g.edges[v] {
88 if !visited[neighbor] {
89 g.dfs(neighbor, visited, scc)
90 }
91 }
92}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected