https://github.com/ydah/graphomaton
A tiny Ruby library for generating finite state machine (automaton) diagrams as SVG.
https://github.com/ydah/graphomaton
automation diagrams graph-tool visualizer
Last synced: 9 months ago
JSON representation
A tiny Ruby library for generating finite state machine (automaton) diagrams as SVG.
- Host: GitHub
- URL: https://github.com/ydah/graphomaton
- Owner: ydah
- License: mit
- Created: 2025-08-26T10:11:48.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-26T10:34:10.000Z (10 months ago)
- Last Synced: 2025-08-26T11:38:53.303Z (10 months ago)
- Topics: automation, diagrams, graph-tool, visualizer
- Language: Ruby
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Graphomaton [](https://badge.fury.io/rb/graphomaton) [](https://github.com/ydah/graphomaton/actions/workflows/ci.yml)
A tiny Ruby library for generating finite state machine (automaton) diagrams as SVG.

## Installation
Add this line to your application's Gemfile:
```ruby
gem 'graphomaton'
```
And then execute:
```bash
bundle install
```
Or install it yourself as:
```bash
gem install graphomaton
```
## Usage
```ruby
require 'graphomaton'
# Create a DFA that accepts strings ending with 'ab'
automaton = Graphomaton.new
# Add states
automaton.add_state('q0')
automaton.add_state('q1')
automaton.add_state('q2')
# Set initial and final states
automaton.set_initial('q0')
automaton.add_final('q2')
# Add transitions
automaton.add_transition('q0', 'q1', 'a')
automaton.add_transition('q1', 'q2', 'b')
automaton.add_transition('q0', 'q0', 'b')
automaton.add_transition('q1', 'q0', 'a')
automaton.add_transition('q2', 'q0', 'b')
automaton.add_transition('q2', 'q1', 'a')
# Save as SVG
automaton.save_svg('output.svg')
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ydah/graphomaton.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Graphomaton project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ydah/graphomaton/blob/main/CODE_OF_CONDUCT.md).