0

I want to draw Directed Acyclic Graphs(DAG) as below. I have tried Visio, only to find it's very unhandy to do this. I need to draw the graph manually rather than produce one according to the logs in the .git directory.

example graph
Example graph (click image for larger variant)

Do you have any recommendations? Since I may only use it once in a blue moon a free-of-charge one is the best.

My OS is Ubuntu. Since I'm a student I expect that it would provide a free plan for us. I don't like drawing graphs in a clike-and-drag way, so a friendly text language is highly appreciated. It doesn't matter too much when it comes to vestor formats or bitmap formats. I will only take a screenshot of the graph to put in MS Word. Sorry. I was kind of forced to write my thesis using Word. If there is no free one available I'll give graphviz a try.

  • 1
    It's duplicated: stackoverflow.com/questions/8977859/… – Lerner Mar 17 '16 at 1:51
  • PS: Take a look at Trac (see my answer here). It's certainly much more than you've asked for, but it includes drawing those graphs automatically (with the proper plugin, available for free) based on your repository. Btw: what version control system are you trying to visualize? There might be other tools which can provide this. – Izzy Mar 17 '16 at 10:07
  • @lzzy Thank you. – Lerner Mar 17 '16 at 13:35
2

a friendly text language is highly appreciated

That reminds me of Graphviz, though the output would look a bit different from normal directed acyclic graph (please check the linked Wikipedia page for other examples). You simply define the dependencies/links one per line (like A -> B), define formatting in a similar way (A [color=blue], B [shape=box]), and then have it create the graph. That "text language" is called Dot.

That's basically what's used by Trac (which I already mentioned and recommended in my answer here). Some simple example to visualize what it is about, taken from this tutorial:

enter image description here
Graphviz example: "Directed Acyclic Graph" (source: Wikipedia; click graphic for larger variant)

// Directed Acyclic Graph

digraph G {
size ="4,4";
main [shape=box]; /* this is a comment */
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> { make_string; printf}
init -> make_string;
edge [color=red]; // so is this
main -> printf [style=bold,label="100 times"];
make_string [label="make a\nstring"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
}

Graphviz is available cross-platform for free (just run a apt-cache search graphviz to find all related packages, or search for the term "graphviz" with Aptitude/Synaptics (or "Software Center", or whatever you use as frontend ;) No need to take screenshots; plenty of ways to have Graphviz export to a number of formats from bitmaps to vector graphics. I'm using Graphviz myself for visualization (e.g. the graph on this page is made using it, and my HyperSQL uses it to generate its dependency graphs), so – for these specific topics – I can really recommend it. Might need a little "playing around" though to get the wanted results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.