find first path from node to node with DFS
(from *Node, to *Node)
| 173 | |
| 174 | // find first path from node to node with DFS |
| 175 | func findFirstPath(from *Node, to *Node) []*Node { |
| 176 | isVisited := map[string]bool{} |
| 177 | pathList := []*Node{from} |
| 178 | |
| 179 | // Call recursive utility |
| 180 | if findFirstPathRecursive(from, to, isVisited, &pathList) { |
| 181 | return pathList |
| 182 | } |
| 183 | |
| 184 | return nil |
| 185 | } |
| 186 | |
| 187 | // A recursive function to print |
| 188 | // all paths from 'u' to 'd'. |