// NewDfs execute the DFS search on a graph, start from the root node
NewDfs execute the DFS search on a graph, start from the root node
// NewDfs execute the DFS search on a graph start from the root node
func NewDfs(g graph.Graph, root graph.NodeID, m implementMethod) (*Dfs, error) {
	dfsContext := &Dfs{0, []dfsTree{}, nodeAttrArray{}, edgeAttrArray{}}
	dfsContext.initialize(g)
	dfsContext.forest = append(dfsContext.forest, dfsTree{root}) 
	switch m {
	case Recurse:
		dfsContext.dfsRecurseVisit(g, root)
	case StackBased:
		dfsContext.dfsStackBasedVisit(g, root, nil)
	}
	return dfsContext, nil
}
func NewDfs ( g graph . Graph , root graph . NodeID , m implementMethod ) ( * Dfs , error ) { dfsContext := & Dfs { 0 , [ ] dfsTree { } , nodeAttrArray { } , edgeAttrArray { } } dfsContext . initialize ( g ) dfsContext . forest = append ( dfsContext . forest , dfsTree { root } ) switch m { case Recurse : dfsContext . dfsRecurseVisit ( g , root ) case StackBased : dfsContext . dfsStackBasedVisit ( g , root , nil ) } return dfsContext , nil }
NewDfs execute the DFS search on a graph, start from the root node
NewDfs execute the DFS search on a graph start from the root node
// Initialize //record a tree's root // execute one tree search