Closed kalmarek closed 2 years ago
trace
is nice.break
(or lack of it) in walk/trace
- I have no feelings about it.outneighbors
is better.Continuing point 1 from above:
push!(::Automaton, ::W)
would actually return the state created, otherwise we leak the implementation detail (at least in one or two places) that this push!
actually pushes the newly created state to the last place in some internal vector, see e.g. https://github.com/kalmarek/KnuthBendix.jl/pull/38/files#diff-ba45e2be10d1f5b03e3f0f6145c6c34920b4a89ad7aa6c0be65fcb6c15d47e66R268.addedge!(at::Automaton, label::Integer, src::Integer, dst::Integer)
in favour of `addedge!(at::Automaton, label::Integer, src::State, dst::State)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.
rendered invalid by #54
Just collecting some ideas after #38 is merged.
walk(::Automaton, ::AbstractWord)
trace
outedges(state)
→ this doesn't return an edge but a neighboring state ;) LightGraphs.jl useoutneighbors
: https://github.com/JuliaGraphs/LightGraphs.jl/blob/ce533729381a6c0b0d8a1eb5f0c3e058833cb55b/src/interface.jl#L336 (I don't mean using LightGraphs directly, but adopting their naming)