automata icon indicating copy to clipboard operation
automata copied to clipboard

Kleene's Algorithm for NFA to Regex conversion

Open Tagl opened this issue 2 months ago • 3 comments

Input is an NFA and output is a Regular Expression that represents the same language as the NFA.

https://en.wikipedia.org/wiki/Kleene%27s_algorithm

This would probably be a useful addition to the library. I might try implementing this in November/December if time allows for it, but I thought it good to leave it here as well.

Tagl avatar Nov 12 '25 23:11 Tagl

@tagl I'm pretty sure we already have an algorithm for converting an NFA to regex? This is done through the gnfa class.

eliotwrobson avatar Nov 12 '25 23:11 eliotwrobson

You are right, my friend and I could not find it in the documentation though. Maybe just a skill issue on our part though.

Tagl avatar Nov 13 '25 00:11 Tagl

I don't think it's super obvious that's what the GNFA is for, maybe having some additional note in the documentation is good?

@Tagl if you're looking for algorithmic enhancements to make to the package, I think the most impactful / interesting would be https://github.com/caleb531/automata/issues/161. That has been open for a long time and is pretty tricky, but would be a significant performance improvement for DFAs over large alphabets.

eliotwrobson avatar Nov 13 '25 02:11 eliotwrobson