# What is the best graph editor to use in your articles?

Here is the criteria for a "perfect" graph editor:

• it should be able to perform an automated, but controllable layout
• one is able to make "manual" enforcements to nodes and edges locations when you need it (or at least such fine automated layout so you don't need "manual" enforcements)
• one could add some math symbols and formulae on a graph

Common vector graphics editors could do the trick, but there is a lot of overhead efforts to draw every node, every edge, every label.

Graphviz is good enough, but sometimes you cannot get needed layout (even if you use several tricks like additional invisible nodes etc) and you should use ladot or dot2tex for math formulae

yEd has nice layouts, but there is a problem with a math text.

This is probably not a math question, but it is common to draw graphs in articles i think.

Result graph

(Update: 27.12.2010) Here is another candidate for the best editor in TeX - Asymptote (asymptote.sf.net). The very powerful tool at first glance.

(Update: 28.04.2014) The very tasty semiautomated tool to use with PGF/TiKZ is TiKZEdt. You can extend its palette with your own tools and make the process of diagram creation very simple!

• Community wiki? – Loop Space Feb 18 '10 at 9:42
• Andrew -- I agree with that. – algori Feb 18 '10 at 12:13
• @ Leonid, edit the question and check the Community Wiki box.. – Abhishek Parab Feb 18 '10 at 12:18
• It seems that someone already made it "cw". PGF/TikZ did the trick. Here is my result: [Original graph](mathtech.ru/0pocket/grf.jpg) [Result graph](mathtech.ru/0pocket/grf_res.jpg) I've found that this tool is very best and it satisfies all of the listed requirements. I will also check other proposed tools and mark them as answers if they will be as good. – Leonid Dworzanski Feb 18 '10 at 15:33
• Leonid: Your final layout has vertex labels that are difficult to read because they are crossed by edges of the graph, self-loops that are so small relative to the vertex size that they look like bumps on their vertices with labels that are placed close enough to the vertices that they look like vertex labels, and arrowheads that are too small to see. I'd expect a good drawing tool to make it easy to avoid these sorts of problems. – David Eppstein Jun 8 '10 at 0:28

I already had about 30 pages of graphs typeset with xymatrix for my thesis before discovering tikz; but was so impressed by it that I was happy to rewrite them all. As well as (imho) looking better, it gave me cross-platform compatibility - xypic seems to need pstricks, so on the mac with TeXshop (which uses pdflatex, I assume) the old graphs couldn't even be rendered.

Its ability to construct graphs iteratively can also be a massive timesaver- for instance, I wanted a bunch of otherwise identical rectangles at various positions, so with tikz could just loop over a list of their first coordinate rather than having to tediously cut,paste and modify an appropriate number of copies of the command for a rectangle. Particularly handy when I then decided they all needed to be slightly wider!

There's a gallery of tikz examples here, to give you some idea of what it's capable of (and with the relevant source code- I did find the manual a bit hard to understand and learnt mostly by examples or trial and error).

The vector graphics package inkscape (which I used to use for drawing more complicated graphs for inclusion as eps images) also apparently has a plugin to export as tikz, although I haven't tried that out.

• +1 for mentioning texample; there are some fantastic examples of what TikZ can do there. In particular, there's a really nice picture of a torus ... – Loop Space Feb 18 '10 at 14:26
• Inkscape is great, it has a plugin to add latex to the images you make. With good copy pasting and once you getused to the tools it is MuCH faster than typing the diagram in xypic. Additionnally you get much more control of your diagrams. – B. Bischof Feb 18 '10 at 14:44
• You are absolutely right about PGF/TikZ but just a minor correction - TeXshop can easily be configured to use either pdflatex to generate PDF directly or latex + dvips to generate PS (see the "Typeset" menu and choose "Tex and Ghostscript") – Gordon Royle Mar 16 '10 at 11:40
• Another reason to use TikZ is that it has seamless integration with the Beamer package for making slides. Now when you give subsequent talks about your big result it is easier then ever. – Chris Schommer-Pries Apr 6 '10 at 11:20
• @Chris: Almost as if they were designed that way ... – Loop Space Apr 6 '10 at 13:34

For something quick (and not necessarily dirty) you can use XFig — TeX symbols are allowed, and there's quite a lot you can do (it's quite impressive how powerful this 'oldie' can be ;-).

For something more elaborate, i'd say PGF and TikZ — this is a very powerful tool, and you can virtually do whatever you want with it.

For some sort of "middle ground" approach, you can maybe try Xy-pic — this is not as old as XFig and not as new as PGF/TikZ; and used to be the standard way to go for graphs. ;-)

Hope this helps.

• I'm growing to use TikZ more and more nowadays - neat, versatile and makes really pretty and easily customizable results. – Mikael Vejdemo-Johansson Feb 18 '10 at 5:12
• @Mikael: PGF/TikZ is a very resourceful tool, up-to-par with PSTricks and much easier than MetaPost or MetFont — or even Asymptote for that matter. ;-) – Daniel Feb 18 '10 at 5:41
• As Daniel say, Xfig is very useful. It exists for many platforms (I use a java based version on a Mac.) I do not like the exports to Pictex, which takes an enormous amount of text to produce a curved line, and Pictex can be clunky. A great thing however is that once you get used to it you can adjust the position of any maths symbols with great precision for best visual effect. I also use xypic for basic (category style) diagrams and know that it is possible to do wonders with that... but have not learnt to ...yet! It still is the standard way for diagrams in Cat Theory. – Tim Porter Feb 18 '10 at 7:07
• I have used XFig in the past, too, but then I replaced it with Inkscape (and later with TikZ). I think Inkscape can do everything XFig does, with more extensions and a nicer interface. Let me know if you have counterexamples to this claim. – Federico Poloni Dec 27 '10 at 15:46

Graphviz is extremely powerful and I'd be surprised to discover that it doesn't do what you need. It only generates the positions of nodes that aren't already specified so if you need fine tuning then you can run it to get a basic graph, then fine tune it, and then it'll respect your fine tuning. Also, it comes with an interactive program called dotty which can be used to alter the graphs visually.

One should also distinguish between generating graphs and rendering them. I use graphviz to generate graphs, but don't use it for rendering. For that, if PGF/TikZ can't do it then I'm not interested! PGF/TikZ is absolutely fantastic and has consigned xy.sty, xfig, and all the other stuff that I used to use to the rubbish bin [trash can]. Even for commutative diagrams in category theory!

• I've finally choosen PGF/TikZ for my purposes. Graphviz is nice for graphs with a simple layout. But when you try to demonstrate some vision of the idea it's not the best tool. Because its layout is too hardcoded. That's why one uses all of these tricks like invisible edges and boxes etc – Leonid Dworzanski Mar 28 '10 at 18:59

For adding math symbols I use lpic --- this way you use LaTeX to write over picture,so you can add ALL math symbols NOT just some. BONUS: if you change notation, you do not have to redo picture.

For drawing I often use some geogebra or kig. This soft is mostly designed for compass and straightedge constructions, but I use it as an advanced vector-graphic editor --- it is flexible enough to make virtually any math drawing.

I personnally mostly use xfig, and start moving to inkscape. However I guess that they are not what you want. A friend of mine, working on graphs, uses metapost with great results. Last, for 3D images, I use povray which is very efficient with geometric forms. It renders natively in .png, so the best is to compile with pdflatex. You can find mathematical picture rendered with povray on my web page: http://www-fourier.ujf-grenoble.fr/~bkloeckn/images.html