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
-
I translated this to english and the second link said "Set of balls".. – DanRedux Apr 28 '12 at 00:38
-
what I wanna do is draw an automata like this http://www.google.com/imgres?hl=en&biw=1280&bih=643&tbm=isch&tbnid=q62yfBg-2QjZ5M:&imgrefurl=http://pop-art.inrialpes.fr/~girault/Cours/Automates/td5.html&docid=6Ro8kL90vJ_XYM&imgurl=http://pop-art.inrialpes.fr/~girault/Cours/Automates/determine-solution.gif&w=404&h=317&ei=nDmbT634GunH0QX_2_SYDw&zoom=1&iact=hc&vpx=190&vpy=148&dur=321&hovh=199&hovw=254&tx=151&ty=114&sig=100406407692710228905&page=1&tbnh=137&tbnw=175&start=0&ndsp=16&ved=1t:429,r:0,s:0,i:68 – Wassim Sboui Apr 28 '12 at 00:42
-
1@DanRedux: so? I translated it into German, and it was „Kugelspiel“, which is the common name for that kind of automaton. – Roland Illig Apr 28 '12 at 00:43
-
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. – Roland Illig Apr 28 '12 at 00:45
-
1Another option: generate a .dot file from java, and let http://www.graphviz.org do the rendering in whatever image format you like. – Riccardo T. Apr 28 '12 at 00:47
2 Answers
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.

- 8,030
- 5
- 41
- 51
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

- 563
- 7
- 23
-
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 http://stackoverflow.com/questions/10395825/create-a-regular-expression-using-data-extracted-from-an-xml-file – Wassim Sboui May 03 '12 at 12:40
-
1Aha, 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. – sm13294 May 03 '12 at 18:28