LearnLib / automatalib

A free, open-source Java library for modeling automata, graphs, and transition systems
http://automatalib.net
Apache License 2.0
92 stars 34 forks source link

Graphviz DOT output #7

Closed juangamnik closed 7 years ago

juangamnik commented 10 years ago

Since the models learnlib infers are AFAIK always some kind of automaton, the DOT output should look like an automaton. Here is an example how this could be realized:

digraph DFA {
  node [shape=circle,width=0.35,height=0.35,fixedsize=true]
  edge [arrowhead=vee]

  q0 [label=<q<SUB>0</SUB>>];
  q0 -> q1[label=AUI,penwidth=4,color=red]
  q0 -> q2[label=UDI]
  q1 [label=<q<SUB>1</SUB>>];
  q1 -> q3[label=SR,penwidth=4,color=red]
  q1 -> q4[label=UDI]
  q2 [label=<q<SUB>2</SUB>>];
  q2 -> q4[label=AUI]
  q3 [label=<q<SUB>3</SUB>>];
  q3 -> q5[label=UDI]
  q4 [label=<q<SUB>4</SUB>>];
  q4 -> q5[label=SR]
  q5 [label=<q<SUB>5</SUB>>,shape=doublecircle];
}
juangamnik commented 10 years ago

The result looks like this:

rbt1-hyp

misberner commented 10 years ago

Could you maybe explain how this is different from existing dot outputs? The only difference I could spot is the subscript of the node id and that some transitions are colored in red. Both aspects are somewhat specific and can easily be achieved using your own dot helper. Or did I miss something? On Dec 6, 2013 1:41 PM, "juangamnik" notifications@github.com wrote:

Since the models learnlib infers are AFAIK always some kind of automaton, the DOT output should look like an automaton. Here is an example how this could be realized:

digraph DFA { node [shape=circle,width=0.35,height=0.35,fixedsize=true] edge [arrowhead=vee]

q0 [label=<q0>]; q0 -> q1[label=AUI,penwidth=4,color=red] q0 -> q2[label=UDI] q1 [label=<q1>]; q1 -> q3[label=SR,penwidth=4,color=red] q1 -> q4[label=UDI] q2 [label=<q2>]; q2 -> q4[label=AUI] q3 [label=<q3>]; q3 -> q5[label=UDI] q4 [label=<q4>]; q4 -> q5[label=SR] q5 [label=<q5>,shape=doublecircle]; }

— Reply to this email directly or view it on GitHubhttps://github.com/misberner/automatalib/issues/7 .

juangamnik commented 10 years ago

Oh the red highlighting was part of the example only, sorry. But I think the differences are remarkable ;). I'm happy with a dot helper if I can change there the necessary stuff. The differences:

The changes are subtle but have a great impact on the overall look of an automaton (especially the shapes of the nodes)

misberner commented 10 years ago

Okay, I see your point. Some remarks:

My main concern is generality. Setting less options leaves more room for flexibility. For example, if I decide to use custom (more descriptive) edge labels, I will have to (know that I have to) change a) the node shape b) the fixedsize attribute. Introducing an additional DOT helper which imposes these rules at a global level should not be a problem and I can do that, but I'd rather not make it a default for the above reasons. As for the subscript, I do not want a default policy which causes error messages in many versions of GraphVIZ, even if those are non-fatal errors. (On a side note: By default, the states simply do not have labels. "s0" etc. are just the identifiers used for the states itself.)

I can and will add respective DOT helpers. Nevertheless, if prettiness is a concern, I'd suggest you take a look at the dot2tex tool.

juangamnik commented 10 years ago

A remark to your remarks: of course these suggestions are not the answer to everything. There are pros and cons. So I am perfectly d'accord with moving these enhancement to a DOT helper.

I can and will add respective DOT helpers. Nevertheless, if prettiness is a concern, I'd suggest you take a look at the dot2tex tool.

That's cool. I will check that out. I asked, whether someone knows something like this, but nobody knew (you weren't in your office). So thank you very much.

If you like, you can close the issue or let it open until the DOT helpers are added?!? If you tell me where I can find an example DOT helper and where to put mine, I may implement the helper, too.

juangamnik commented 10 years ago

Unfortunately I didn't get nice output from dot2tex in a reasonable amount of time. I will have a further look into it, but first experiments led to very ugly results:

dot2tex-text

And there was a bug in the current version of ubuntu I had to fix manually ;) 0. But hey its open source.

juangamnik commented 10 years ago

I will try to find a "good solution" and write a tutorial on my blog. You may then link it in your documentation. An easy to use and hilariously looking dot2latex template would be of interest for any computer scientist working with learnlib, hu?

juangamnik commented 7 years ago

No good solution found so far...