Added haddock comments to graph module and simplified implementation of dfs.