Closed EduardoGoulart1 closed 1 year ago
By using this design, support for allow_partial can be added quite naturally by adapting the state transition functions.
Also, the issubset
, isdisjoint
and isempty
methods can be implemented faster by switching to DFS instead of BFS
This design seems cool! I think we might want to wait till an initial version of the type hints PR is merged, since this changes a significant number of those. But I think this refactor with the generator makes things more flexible.
Also, the
issubset
,isdisjoint
andisempty
methods can be implemented faster by switching to DFS instead of BFS
I don't think this is always true. Those functions are searching for a single state as a counterexample, in the worst case they all have to search every reachable state.
@EduardoGoulart1 I like the approach of this architecture, but also agree with @eliotwrobson about the BFS matter. Fortunately, I have just merged the types PR (#131) so you can continue to work on this PR.
Sorry, I think I expressed myself badly. Yes, both have the same worst-case complexity. But I was starting from the assumption that end states are "deeper" in the DFA, which we might want to verify.
In any case, isempty
will profit from early-stopping. But, I won't change anything related to it in this PR
Closing this one. See https://github.com/caleb531/automata/pull/139
@caleb531 @eliotwrobson I wanted to drop a proposal to decouple the logic of the cross-product. The idea is to turn the exploration method into a function that receives an initial state and an expansion function and applies BFS using only that. This makes the current implementation cleaner and will also significantly simplify the implementation for
allow_partial
I did some microbenchmarks and noted that the overhead is relatively small.
Please do not make a full review of this PR. If you approve the design I will clean it up to make it ready to merge.