Automata.Visualization
1.0.3
dotnet add package Automata.Visualization --version 1.0.3
NuGet\Install-Package Automata.Visualization -Version 1.0.3
<PackageReference Include="Automata.Visualization" Version="1.0.3" />
paket add Automata.Visualization --version 1.0.3
#r "nuget: Automata.Visualization, 1.0.3"
// Install Automata.Visualization as a Cake Addin #addin nuget:?package=Automata.Visualization&version=1.0.3 // Install Automata.Visualization as a Cake Tool #tool nuget:?package=Automata.Visualization&version=1.0.3
🔂 Automata: A lightweight library for Finite-State Automata
Automata.Core - Core library (zero-dependency library, optimal if you do not need visualization)
Automata.Visualization - Full library that also includes visualization and rendering of automata.
The Automata library provides functionality for working with finite-state automata.
⭐ Example Features:
- Create NFAs (Non-deterministic Finite Automata) from sequences or other data.
- Convert NFAs to DFAs (Deterministic Finite Automata).
- Minimize Automata to reduce states while preserving functionality.
📝 Source Code
Find the source code on GitHub:
Automata GitHub Repository
🔨 Automata.Core - Core Library
The core library provides essential tools for finite-state automata operations. It offers a lightweight and clean solution without visualization features.
💡 C# Example: Create and Manipulate Automata
//Create some random sequences of strings
var sequences = Enumerable.Range(0, 10)
.Select(_ => Enumerable.Range(0, 8)
.Select(_ => Random.Shared.Next(4).ToString()));
// Create an empty NFA.
NFA nfa = new NFA();
// Add all sequences to the NFA
nfa.AddAll(sequences);
// Determinize the NFA to a DFA
DFA dfa = nfa.ToDFA();
// Minimize the DFA
DFA minDFA = dfa.Minimized();
🖼️ Automata.Visualization: Automata.Core + Visualization
The Automata.Visualization library extends the core Automata functionality with visualization capabilities, powered by MSAGL (Microsoft Automatic Graph Library).
🔑 Key Features:
- Visualize automata as graphs.
- Includes all core Automata functionality.
💡 C# Full example program: Create an automaton and display it from a Console app
using Automata.Visualization;
Console.WriteLine("Creating graph."); // Write some text output to the console window
var sequences = Enumerable.Range(0, 10).Select(_ => Enumerable.Range(0, 8).Select(_ => Random.Shared.Next(4).ToString())); //Create some random sequences of strings
IFsa fsa = new NFA(sequences).ToDFA().Minimized();
Graph graph = GraphFactory.CreateGraph(fsa); // Create a graph object from the automaton
//Graph graph = GraphFactory.CreateGraph(sequences); //Alternatively you can use this command, to replace the 2 lines above
GraphView graphView = GraphView.OpenNew(graph); // Open a new non-modal interactive window that displays the graph in it
Console.WriteLine("Graph is displayed."); // Write some text output to the console window
📦 NuGet package Installation
Install the packages via the .NET CLI or Package Manager in Visual Studio.
Automata.Core
dotnet add package Automata.Core
Automata.Visualization (includes Automata.Core)
dotnet add package Automata.Visualization
💻 Target Framework Compatibility
- Automata.Core: .NET 9.0 and later
- Automata.Visualization: .NET 9.0 and later
🔗 Dependencies
Automata.Core:
- None
Automata.Visualization:
-
These dependencies will be automatically installed when you install
Automata.Visualization
via NuGet.
📜 License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0-windows7.0 is compatible. |
-
net9.0-windows7.0
- Automata.Core (>= 1.0.3)
- Microsoft.Msagl.GraphViewerGDI (>= 1.1.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Minor improvements and API updates