anchor.diff:              if not cont then state 
               else inner rest discovered state
           // Pre
  -        | (v, v' :: edges) :: rest ->
  -            let work' = (v, edges) :: rest
  +        | (v, e :: restEdges) :: rest ->
  +            let v' = (e : IEdge<_,_>).To 
  +            let work' = (v, restEdges) :: rest
               if not (discovered |> Set.contains v') then
  -                let edges = lookupEdges v'
  -                let state, cont = state |> onNewVertex v'
  -                if not cont then state 
  -                else 
  -                    let state, cont = state |> onEdge v v'
  -                    if not cont then state else
  -                        inner ((v', edges) :: work') (discovered |> Set.add v') state
  +                let state, cont = state |> onEdge v e
  +                if not cont then state else 
  +                    let newEdges = lookupEdges (v')
  +                    let state, cont = state |> onNewVertex v'
  +                    if not cont then state 
  +                    else inner ((v', newEdges) :: work') (discovered |> Set.add v') state
               else
  -                let state, cont = onEdge v v' state
  +                let state, cont = onEdge v e state
                   if not cont then state
                   else inner work' discovered state   
       if adjlist |> Seq.isEmpty |> not then
  -        let first = adjlist |> Seq.nth 0
  -        inner [first.Key, lookupEdges first.Key] Set.empty initialState
  +        inner [startAt, lookupEdges startAt] Set.empty initialState
       else initialState
   
   /// Result container for the traverseWithTimes function
  
positive.code: open Edgy.DirectedPath
  
  /// Generalized depth-first search over a graph
  let dfsPure onNewVertex onEdge onDoneVertex initialState (graph: IGraph<_,_>) =
      let adjlist = Graph.toAdjacencyList graph
      let lookupEdges v = adjlist.[v] |> Seq.map (fun e -> e.To) |> Seq.toList
      let rec inner work discovered state =
          match work with
          // Done
  
negative.code:     }
  
  /// Depth-first graph traversal with integer ordering of when nodes were visted
  let traverseWithTimes (startAt: 'a) (graph: IGraph<_,_>) = 
      let onnewvertex v (time, entrytime, exittime) = let time = time + 1 in (time, entrytime |> Map.add v time, exittime), true
      let onedge _ _ state = state, true
      let ondonevertex v (time, entrytime, exittime) = (time, entrytime, exittime |> Map.add v time), true
      let finaltime, entryTimes, exitTimes = dfsPure onnewvertex onedge ondonevertex (0, Map.empty, Map.empty) startAt graph
      { FinalTime = finaltime; EntryTimes = entryTimes; ExitTimes = exitTimes}
  
  /// Finds all verticies in the graph that match the predicate via Depth-first traversal, returns a list in visited order
  let findVertices (startAt: 'a) (predicate: _ -> bool) (graph: IGraph<_,_>) = 
      let onNewVertex v acc = 
          let acc = if predicate v then v :: acc else acc
          acc, true
      let onEdge _ _ acc = acc, true
      let onDoneVertex _ acc = acc, true
      dfsPure onNewVertex onEdge onDoneVertex List.empty startAt graph 
  
  /// Find first vertex in the graph that matches the predicate via Depth-first traversal
  let findFirstVertex (startAt: 'a) (predicate: _ -> bool) (graph: IGraph<_,_>) = 
      let onNewVertex v acc = 
          if predicate v 
          then Some v, false 
          else acc, true
      let onEdge _ _ acc = acc, true
      let onDoneVertex _ acc = acc, true
      dfsPure onNewVertex onEdge onDoneVertex None startAt graph 
  
  /// Finds all edges in the graph that match the predicate via Depth-first traversal, returns a list in visited order
  let findEdges (startAt: 'a) (predicate: _ -> bool) (graph: IGraph<_,_>) = 
      let onNewVertex _ acc = acc, true
      let onEdge _ edge acc = 
          if predicate edge then edge :: acc, true
          else acc, true
      let onDoneVertex _ acc = acc, true
      dfsPure onNewVertex onEdge onDoneVertex List.empty startAt graph |> List.rev