Graphics, Figures & TablesAdvice on building dependency diagram

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nvedia
Posts: 4
Joined: Fri Feb 20, 2015 11:03 pm

Advice on building dependency diagram

Post by nvedia »

I have to build a dependency diagram

There are 5 systems, S1, S2, S3, S4, S5

S1 --> S2 means S1 depends on S2

S1 --> S2, S3, S4

S2 --> S3, S5

S3 --> S2, S5

S4 --> S5

S5 --> S1, S2, S3, S4

How can I build dependency diagram like the one attached?

Also, is it possible that once I click on node S1, I get all the direct dependencies highlighted?
Attachments
dependancy_graph.jpg
dependancy_graph.jpg (24.46 KiB) Viewed 8992 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Advice on building dependency diagram

Post by Johannes_B »

Hi and welcome,

for drawing, i would recommend tikz. A bunch of quite similar graphs can be found in the graphs directory of TeXample.net.

What exactly do you mean by clicking and highlighting? Not sure, if this is so easy without the normal pdf-spec.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
nvedia
Posts: 4
Joined: Fri Feb 20, 2015 11:03 pm

Re: Advice on building dependency diagram

Post by nvedia »

Thanks Johannes_B
This is what I mean by highlighting

http://live.yworks.com/demobrowser/inde ... aph-Viewer

Also, using Texample, can I just put my dependencies in one file and all the graphs would be built automatically as I keep changing the data ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Advice on building dependency diagram

Post by Johannes_B »

the pdf format is kind of static, for good reasons. There might be something doable with Java Script inside pdf, but this is not really a good idea (imho).

What do you mean by putting all dependencies in a file? Each graph will most likely be on tikz-picture. You need to do manual some work to get the graphs, there is no completely automated version.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
nvedia
Posts: 4
Joined: Fri Feb 20, 2015 11:03 pm

Advice on building dependency diagram

Post by nvedia »

Johannes_B wrote:
What do you mean by putting all dependencies in a file? Each graph will most likely be on tikz-picture. You need to do manual some work to get the graphs, there is no completely automated version.
What I mean is given this data
S1-->S2, S3
S3-->S1, S4

the program should position the nodes and draws lines accordingly between different nodes
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Advice on building dependency diagram

Post by Johannes_B »

Ah, now i understand. Yues, tikz should do that for you.
But to be honest, i am no tikz expert.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Advice on building dependency diagram

Post by Stefan Kottwitz »

Yes, there's a graphdrawing library which works on similar dependency input, and creates graphs. It's described in the TikZ manual, Part IV. I just don't have a compiler at hand right now, perhaps I can show an example later.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Advice on building dependency diagram

Post by Stefan Kottwitz »

Here's a sample with your data.

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,graphs,graphdrawing}
\usegdlibrary{trees, layered, circular, force}
\begin{document}
\begin{tikzpicture}[>=stealth, rounded corners]
  \graph [layered layout, level distance=6em,
    sibling distance=8em,
    nodes={draw,circle}] {
      S2 -> {S3, S5},
      S1 -> {S2, S3, S4},
      S3 -> {S2, S5},
      S4 -> S5,
      S5 -> {S1, S2, S3, S4};
      { [same layer] S1, S4 };
      { [same layer] S2, S3 };
    };
\end{tikzpicture}
\end{document}
Compiling with LuaLaTeX gives:
graph.png
graph.png (8.79 KiB) Viewed 8933 times
Stefan
LaTeX.org admin
nvedia
Posts: 4
Joined: Fri Feb 20, 2015 11:03 pm

Re: Advice on building dependency diagram

Post by nvedia »

Thanks so much Stefan
it worked!
Post Reply