rohaquinlop / automathon Goto Github PK
View Code? Open in Web Editor NEWA Python library for simulating and visualizing finite automata
Home Page: https://rohaquinlop.github.io/automathon/
License: MIT License
A Python library for simulating and visualizing finite automata
Home Page: https://rohaquinlop.github.io/automathon/
License: MIT License
Change the format to lowercase on variables names.
Improve the code quality
Find unused dependencies and remove them
automathon/automathon/finiteAutomata/nfa.py
Line 177 in 06b9858
Reduce the cognitive complexity of the actual functions
Add the following algorithms:
DFA:
NFA:
Refactor DFA and NFA definition to make use of dataclasses, replace __init__
with dataclasses.
Refac this...
def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
self.name = name
self.unit_price = unit_price
self.quantity_on_hand = quantity_on_hand
to this...
from dataclasses import dataclass
@dataclass
class InventoryItem:
"""Class for keeping track of an item in inventory."""
name: str
unit_price: float
quantity_on_hand: int = 0
def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand
I've used the tool to generate a cartesian product of 3 finite automata, but the resulting graph is huge and when I try to view the picture, it becomes problematic to understand what is happening because the font is very small and the graph nodes themselves are too huge. It would be great if we had the option to select those graph parameters, or even better, introduce some python graphviz interface to be able to configure the graph plot settings to our preferences.
Similar as I'm doing in complexipy make use of GitHub actions to deploy directly to PyPI
Explore implementations and add the minimize
function to the DFA
class, this function already exists in the NFA
class.
Consider reading the book Automata Theory: An Algorithmic Approach used by @tchaumeny in his article.
According to the formal definition of the NFA that is mentioned in the book Automata and Computability
, the NFA contains multiple start states
instead of one single initial state
as is defined here in the library.
To maintain the formal equality, it is important to consider this as a refactor of the NFA definition.
Explore the different options to create a docs website with all the information about this library
Update documentation with the new methods
Hi,
Thanks for the library!
I generate an NFA with the following data and attempt to remove epsilon transitions.
The result is incorrect: in the produced DFA, it becomes possible to jump from A to D without passing through B and C.
Another issue I've found is that if there are two mirroring epsilon transitions, i.e. from 1 to 2 and from 2 to 1, attempting to remove epsilon transitions breaks with a max recursion error.
Any idea what's happening? If need be I could potentially help with a fix!
Thanks
Considering some of the changes that were made during the code refactoring, it is necessary to update the documentation
Checkout python library for testing called hypothesis
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()
.
Upgrade to the latest rules_python
and organize the project structure
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.