Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow states to be any immutable object (not just strings) #14

Closed
tchaumeny opened this issue Jan 5, 2024 · 1 comment
Closed

Allow states to be any immutable object (not just strings) #14

tchaumeny opened this issue Jan 5, 2024 · 1 comment

Comments

@tchaumeny
Copy link

Thanks for your library that I have used to illustrate an article about DFA (see here)!

I actually wanted to use integers to define the states and I found that this is not possible (it fails when calling automata.view(...)), is there any specific reason for this restriction?

It seems that any hashable object could be a state and the graphviz representation could just use str().

@rohaquinlop
Copy link
Owner

Hey Thomas! Thank you so much for using automathon and the mention on your article.

In the implementation, I tried to keep it the simplest as possible and as in the book Automata and Computability there are many examples using q0 or s1 and so on as states names then implemented all the states as strings.

Right now I'm working on a change to use the python typing and make it like "strict" to use the parameters types as are defined, I don't know if using any immutable object will make fail any other algorithms that are implemented since I'm always assuming that the states are strings also the keys on the delta map.

Once again, thank you for using automathon and letting me know your ideas.

@rohaquinlop rohaquinlop pinned this issue Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants