kalmarek / KnuthBendix.jl

Pure Julia implementation of the Knuth-Bendix completion (focused primarily on groups and monoids)
MIT License
8 stars 2 forks source link

major refactor of IndexAutomaton?? #43

Closed kalmarek closed 2 years ago

kalmarek commented 3 years ago

Just collecting some ideas after #38 is merged.

  1. walk(::Automaton, ::AbstractWord)
    • I think this should be renamed to trace
    • I think there is little advantage of breaking prematurely and returning the last (non-failed) state (even though I suggested this): maybe a simpler solution like below is better?
      function trace(a::AbstractAutomaton, signature::AbstractWord, state=initialstate(a))
      for k in signature
      next = outedges(state)[k]
      isfailstate(next) ? return next : state = next
      end
      return state
      end
  2. outedges(state) → this doesn't return an edge but a neighboring state ;) LightGraphs.jl use outneighbors: https://github.com/JuliaGraphs/LightGraphs.jl/blob/ce533729381a6c0b0d8a1eb5f0c3e058833cb55b/src/interface.jl#L336 (I don't mean using LightGraphs directly, but adopting their naming)
mikolajpabiszczak commented 3 years ago
kalmarek commented 3 years ago

Continuing point 1 from above:

mikolajpabiszczak commented 3 years ago

The first seems sensible.

The second is also sensible - I believe there is only one place in which this addedge! method you want to depreciate is used and it can be easily substituted with the other one. In fact two methods exist just because at the time I was writing them I had no idea which one will be more useful.

kalmarek commented 2 years ago

rendered invalid by #54