Add docs for dfs and bfs

Examples and docuemntation for dfs and bfs algorithms.
Fixes #1037