Make visualisations look more like wiki examples
This commit is contained in:
parent
0656a2faf4
commit
242184cba5
4 changed files with 3 additions and 11 deletions
14
README.md
14
README.md
|
|
@ -19,17 +19,13 @@ This example ghci session converts the NFA shown on the
|
||||||
[wikipedia article about the powerset construction](https://en.wikipedia.org/wiki/Powerset_construction)
|
[wikipedia article about the powerset construction](https://en.wikipedia.org/wiki/Powerset_construction)
|
||||||
into a DFA, using the aforementioned powerset construction.
|
into a DFA, using the aforementioned powerset construction.
|
||||||
|
|
||||||
The conversion assumes that tokens other than `0` and `1` may appear
|
|
||||||
in the input. Because of this, the resulting DFA looks different from
|
|
||||||
the one on wikipedia.
|
|
||||||
|
|
||||||
``` haskell
|
``` haskell
|
||||||
>>> Just a = nfa [ (1,[(only "0",2)],[3]), (2,[(only "1",2),(only "1",4)],[]), (3,[(only "0",4)],[2]), (4,[(only "0",3)],[]) ] (1::Int) [3,4]
|
>>> Just a = nfa [ (1,[(only "0",2)],[3]), (2,[(only "1",2),(only "1",4)],[]), (3,[(only "0",4)],[2]), (4,[(only "0",3)],[]) ] (1::Int) [3,4]
|
||||||
>>> saveDotAsPng "nfa.png" $ nfaToDot a
|
>>> saveDotAsPng "nfa.png" $ nfaToDot a
|
||||||
```
|
```
|
||||||

|

|
||||||
``` haskell
|
``` haskell
|
||||||
>>> saveDotAsPng "dfa.png" $ dfaToDot $ nfaToDfa a
|
>>> saveDotAsPng "dfa.png" $ dfaToDotWithTokens "01" $ nfaToDfa a
|
||||||
```
|
```
|
||||||

|

|
||||||
|
|
||||||
|
|
@ -38,16 +34,12 @@ the one on wikipedia.
|
||||||
This example ghci session minimizes the DFA shown on the
|
This example ghci session minimizes the DFA shown on the
|
||||||
[wikipedia article about DFA minimization](https://en.wikipedia.org/wiki/DFA_minimization).
|
[wikipedia article about DFA minimization](https://en.wikipedia.org/wiki/DFA_minimization).
|
||||||
|
|
||||||
Transitions for the token `1` are specified explicitly (where
|
|
||||||
necessary), while transitions for the token `0` are represented by the
|
|
||||||
default transition marked with `*`.
|
|
||||||
|
|
||||||
``` haskell
|
``` haskell
|
||||||
>>> Just a = dfa [ ("a",[('1',"c")],"b"), ("b",[('1',"d")],"a"), ("c",[('1',"f")],"e"), ("d",[('1',"f")],"e"), ("e",[('1',"f")],"e"), ("f",[],"f") ] "a" ["c","d","e"]
|
>>> Just a = dfa [ ("a",[('1',"c")],"b"), ("b",[('1',"d")],"a"), ("c",[('1',"f")],"e"), ("d",[('1',"f")],"e"), ("e",[('1',"f")],"e"), ("f",[],"f") ] "a" ["c","d","e"]
|
||||||
>>> saveDotAsPng "dfa.png" $ dfaToDot a
|
>>> saveDotAsPng "dfa.png" $ dfaToDotWithTokens "01" a
|
||||||
```
|
```
|
||||||

|

|
||||||
``` haskell
|
``` haskell
|
||||||
>>> saveDotAsPng "dfa_minimized.png" $ dfaToDot $ minimizeDfa a
|
>>> saveDotAsPng "dfa_minimized.png" $ dfaToDotWithTokens "01" $ minimizeDfa a
|
||||||
```
|
```
|
||||||

|

|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
Loading…
Add table
Add a link
Reference in a new issue