ekmett/graphs — pull request #1 by scolobb (2013-08-27 07:39:32+00:00)
Title: Add enterEdge to Bfs and Dfs.

This function notifies the client about the fact that an edge is reached for the first time.

Knowing the edge we use to enter a vertex has important use cases (e.g., when constructing paths (and that's what I'm trying to achieve in my small project)), and I couldn't manage to figure out a simple (~ O(1) ) way of deriving that from the information provided by the four original functions.

While the code is compiling, I am still rather unsure about the validity of some of my changes, and I am particularly unsure about the changes in `bfs` and `dfs`. Firstly, I'm just appending the result of `enterEdge` to whatever is produced by `enqueue` or `go`, which definitely breaks the seemingly apparent idea of "one monoid element per child". Less importantly, I'm not sure I've written those two lines sufficiently concisely and clearly. Therefore I would heartily welcome any suggestions and explanations :-)