Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finite State Machine Diagram #152

Closed
hscells opened this issue Apr 13, 2015 · 3 comments
Closed

Finite State Machine Diagram #152

hscells opened this issue Apr 13, 2015 · 3 comments

Comments

@hscells
Copy link

hscells commented Apr 13, 2015

It is possible to create a FSM in mermaid, it can be NFA or DFA, but it looks kinda ugly.

given this example:

graph LR
   A((A))--0/0-->C((C))
   A((A))--1/0-->B((B))

   B((B))--0/0-->C((C))
   B((B))--1/0-->A((A))

   C((C))--0/0-->C((C))
   C((C))--1/0-->DF((DF))

   DF((DF))--0/0-->E((E))
   DF((DF))--1/0-->A((A))

   E((E))--0/0-->C((C))
   E((E))--1/1-->DF((DF))

It produces this output:
mealy-min md

Does anyone think it is possible to make the lines curved and with no overlap (E->C & DF->A)? It would also be nice to support things like initial state and final states. Writing the markdown for it as well is kind of tedious as well, unless I'm just doing that wrong. Thanks!

@knsv
Copy link
Collaborator

knsv commented May 13, 2015

Tricky one. It is dagre that sets the layout of the flowchart. Maybe this should be reported there (as well).

You could change the rendering by modifying the order of the nodes but that could make the diagram less readable which sort of defeats the purpose. Like in the example below:

graph LR
   DF((DF))--0/0-->E((E))
   E((E))--0/0-->C((C))
   A((A))--1/0-->B((B))
   E((E))--1/1-->DF((DF))
   A((A))--0/0-->C((C))
   C((C))--0/0-->C((C))
   DF((DF))--1/0-->A((A))
   B((B))--0/0-->C((C))
   B((B))--1/0-->A((A))
   C((C))--1/0-->DF((DF))

@knsv
Copy link
Collaborator

knsv commented Jun 7, 2015

I am going through issues am closing this one. Let me know you disagree or need further support.

@knsv knsv closed this as completed Jun 7, 2015
@hscells
Copy link
Author

hscells commented Jun 7, 2015

I may take a look at the code and see if I can make it look nice, if there is enough interest. The thing is, I'm no longer in need of this in the foreseeable future.

mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
* 'master' of github.com:mermaid-js/mermaid-live-editor: (29 commits)
  Release 1.22.10
  Upgrading Mermaid to version 8.10.1
  Release 1.22.10
  Fix error highlight
  Release 1.22.10
  Fix head
  Release 1.22.10
  Bump url-parse from 1.4.7 to 1.5.1
  Bump webpack-cli from 4.6.0 to 4.7.0
  Bump svelte from 3.38.1 to 3.38.2
  Release 1.22.10
  Move static files to public
  Release 1.22.10
  Remove dist
  Fix mermaid-js#152
  Release 1.22.10
  Update builder node version to 14
  Release 1.22.10
  Add volta
  Release 1.22.10
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants