GithubHelp home page GithubHelp logo

nfa-dfa-transition-tool's Introduction

NFA-DFA-transition-tool

a tool automating the transition from NFA to DFA


输入格式如下:

假设 NFA 有n个节点,m条边,则输入为 m+1 行。第一行为节点个数n,接下来m行为节点之间的边,若为空转移 $\varepsilon$ 则输入两个节点,空格隔开;若不是空转移,则输入格式为 node1 char node2 ,其中,char 为输入字符。

规定,NFA中节点编号从 1 开始顺序递增,即node只可能取值为 1,2,3,4...n,并且编号为 1 的节点为起始节点。下面给出示例:

image-20221115174706484

image-20220919194843297

上面两张图分别是 NFA 与确定化后的 DFA,对应输入输出如下:

input:

4
1 a 2
2 a 2
2 b 4
1 4
1 a 3
3 c 3
3 c 4

output:

NFA Graph generated!
DFA Graph begin to generate...
DFA Graph generated!
------------------------Nodes-----------------------
Node0: [1, 4]
Node1: [2, 3]
Node2: [2]
Node3: [4]
Node4: [3, 4]
------------------------Edges-----------------------
Node0 a Node1
Node1 a Node2
Node1 b Node3
Node1 c Node4
Node2 a Node2
Node2 b Node3
Node4 c Node4

Nodes为确定化后的各个节点,与NFA各节点的对应关系如上面所示。Edges为各个节点在不同输入时的状态迁移。与上图结果一致。

PS:由于测试数据不足可能有少数bug,可以 issue 告知

nfa-dfa-transition-tool's People

Contributors

tsyhahaha avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.