Learn R Programming

gTests (version 0.2)

dfs: Depth-first search

Description

One starts at the root and explores as far as possible along each branch before backtracking.

Usage

dfs(s,visited,adj)

Arguments

s

The root node.

visited

N by 1 vector, where N is the number of nodes. This vector records whether nodes have been visited or not with 1 if visited and 0 otherwise.

adj

N by N adjacent matrix.

See Also

getGraph