0

I am learning to use tikz, so pardon me if my question is too simplistic.

We currently draw directed graphs of various networks (10-20 nodes, 25 - 30 edges) in ppt, and I feel that this manual process is highly inefficient. I am trying to automate part of it through tikz.

Below is the first 'draft' of the network in tikz. The code, as described below, will produce pdf file which would not be editable.

I fear that my proposal for complete automation will not be taken up, unless I allow the output to be editable by a human editor.

Is it possible that the output of the tikz graph be manually editable, meaning that some edges and nodes, can be manually adjusted?

So ideally i would like to -

  1. Tikz doing the hard work of graph drawing and placing nodes and edges in the correct places.
  2. None of the edge should go below another node
  3. It looks like (2) will not always be satisfied (for example: Why does PGF/TikZ 3.0 draw my simple layered graph as non-planar by default?), which is when manual editing would come to play.

If both (1) and (2) can always be satisfied, nothing like it. However, at least for starters, I'll need to ensure that graphs are editable by humans.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{layered}

\begin{document}

\tikz [nodes={circle,
draw=black!20, thick, fill=blue!50}]
\graph [layered layout] {
{"1", "2","3","4","5","6"} -> {"7"};
{"8","2","3","5","9"}->{"1"};
{"10","3","4","11","5","12","13","15","16"}->{"2"};
{"14","4","5"}->{"8"};
{"3","13","9"} -> {"14"}
};

\end{document} 
  • 2
    You can edit a pdf file using Inkscape, for example. But You can do a lot of things directly within Tikz. – Sigur Jun 4 '15 at 7:08
  • This could be of your interest: texample.net/tikz/examples/tag/graphs – Sigur Jun 4 '15 at 7:09
  • I'll lookout using Inkscape. What is realized during my exploration was that there would be cases when an edge will pass under a different node (eg: tex.stackexchange.com/questions/171990/…). Can this be avoided? – hardikudeshi Jun 4 '15 at 7:33
  • 1
    @hardikudeshi: If the graphs are going to end up in a PowerPoint presentation, maybe TikZ isn't really the best tool for the job. A dedicated graph layout software like Gephi (open source) might be better for this, since it allows you to do the automatic placement and manual adjustments within the same interface before exporting to a graphics format. – Jake Jun 4 '15 at 8:23

Your Answer

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

Browse other questions tagged or ask your own question.