how to draw automata in java
Asked Answered
S

2

5

i want to draw an automata with edges and circulaire states, something like this http://pop-art.inrialpes.fr/~girault/Cours/Automates/td5.html, have u an example for that

Salverform answered 28/4, 2012 at 0:35 Comment(5)
I translated this to english and the second link said "Set of balls"..Demmer
what I wanna do is draw an automata like this google.com/…Salverform
@DanRedux: so? I translated it into German, and it was „Kugelspiel“, which is the common name for that kind of automaton.Earreach
The graphs are probably drawn using LaTeX, so maybe you can use that: generate a .tex file from Java and let latex do the hard work.Earreach
Another option: generate a .dot file from java, and let graphviz.org do the rendering in whatever image format you like.Scissure
B
7

JGraph is a library you can use that is native to Java and fairly easy to use, or you can generate a .dot file and let GraphViz take care of it for you.

Birchard answered 28/4, 2012 at 2:1 Comment(0)
E
3

If you dont want to carry for things like representing the graph in a correct way such you try to not cross the lines, or to not have two or more nodes in the same position then i suggest you to use grail graph library so you can see the graph using yed works (I can provide you an example of it just write the regular expression you in comment), or if you want to draw the graph by yourself then you probably is good to learn about Layered graph drawing : http://en.wikipedia.org/wiki/Layered_graph_drawing and Coffman Graham algorithm http://en.wikipedia.org/wiki/Coffman%E2%80%93Graham_algorithm

Evette answered 3/5, 2012 at 9:38 Comment(2)
thank you for your answer, in fact, im trying to parse an XMl file , and after that l have to generate the regular expression for the XML file , after that i have to draw the automata, there is an example in this post #10396325Salverform
Aha, i think you have a lot of work to do here. I have done something like that in this way: first I have created an ANTLR specification grammar for valid regular expressions, and the AST as well. Then using the parser and lexer i got from antlr i got a specific CommonTree for each regular expression, I have traversed that tree and built the NFA first (using the Thompson algorithm). When you have NFA, using the subset construction algorithm you can create the DFA graph.Evette

© 2022 - 2024 — McMap. All rights reserved.