tang-hi commented on PR #12286:
URL: https://github.com/apache/lucene/pull/12286#issuecomment-1544374939

   Thank you, @mikemccand, for your valuable feedback. I've made updates to my 
pull request based on your suggestions.
   
   Regarding the modification of the test code, it appears there's no need for 
adjustments. The current test is correct. It was my initial implementation that 
had issues, which caused the test failure.
   
   As for checking if the automaton contains cycles, I have incorporated this 
check in the updated version. I have used a BitSet to track whether the current 
state is already on the stack. If we encounter a state that's already on the 
stack, we've detected a cycle. You can refer to this 
[resource](https://stackoverflow.com/questions/19113189/detecting-cycles-in-a-graph-using-dfs-2-different-approaches-and-whats-the-dif#:~:text=An%20undirected%20graph%20has%20a,vertex%20(a%20back%20edge).&text=In%20addition%20to%20visited%20vertices,of%20function%20for%20DFS%20traversal.)
 for more information on cycle detection.
   
   While adding the BitSet introduces a small overhead and slightly increases 
the complexity of the code, I believe the code remains understandable. Please 
let me know if you have any further suggestions or feedback. 😄
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to