0

the creation of a graph with some specific attributes is for me not possible. Maybe you have some helpfully ideas how to realize?!

The attributes of the graphs in 1. and 2. have to be "mixed", while in 3. the style of the link connection between parent and outgoing chain (child) is a nice to have option.

1. To save space the "layered layout" is preferred but without the labyrinthine chain structure, see lower figure (B). For example, instead of the structure

1-3 -> 5-1 (same line)
    -> 1-4 (new line)

it has to look like

1-3 -> 1-4 (same line)
    -> 5-1 (new line)

2. From the parent chain several child chains can be branched. All chain links from the parent chain have to be in the same line, like in the upper figure (A).

3. The initial link of each outgoing chain (child with the attributes [>red, bend right, very thick]) must be a rectangle instead of a straight line.

Thank you for your help!

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{graphs}
\usetikzlibrary{graphdrawing}
\usegdlibrary{layered}


\begin{document}
    \tikz [
    rotate=90,
    ]
    \graph [
    ]{
        "1-1" -> {
            "1-2" -> "1-3" ->{
                "1-4" ->"1-5"->{
                    "1-6",
                    "2-1"[>red, bend right, very thick]
                    ->"2-2"->{
                        "2-3",
                        "4-1"[>red, bend right, very thick]
                    },
                },
                "5-1"[>red, bend right, very thick]
                ->"5-2"->"5-3"->"5-4"
            },
            "3-1"[>red, bend right, very thick]
            ->"3-2"->"3-3"->"3-4"->"3-5"->"3-6"->"3-7"->"3-8"->"3-9"->"3-10"->"3-11"->"3-12"
        }
    };

    \hspace{2cm}

    \tikz [
    layered layout,
    rotate=90
    ]
    \graph [
    ]{
        "1-1" -> {
            "1-2" -> "1-3" ->{
                "1-4" ->"1-5"->{
                    "1-6",
                    "2-1"[>red, bend right, very thick]
                    ->"2-2"->{
                        "2-3",
                        "4-1"[>red, bend right, very thick]
                    },
                },
                "5-1"[>red, bend right, very thick]
                ->"5-2"->"5-3"->"5-4"
            },
            "3-1"[>red, bend right, very thick]
            ->"3-2"->"3-3"->"3-4"->"3-5"->"3-6"->"3-7"->"3-8"->"3-9"->"3-10"->"3-11"->"3-12"
        }
    };
\end{document}

Here the upper code as an figure: upper (A) and lower (A) example

The idea is to obtain a graph that looks like: enter image description here

1 Answers1

0

The use of the dot language with the program Graphviz together with the dot2tex package (to include the dot figure in LaTeX) was helpful to get the wished result. Benefits of dot is a simpler writing of the graph, see code and figure example.

On the other hand, the squared edge is not always drawn as it should be, see Graphviz edge between nodes wrong drawn.

For everyone how need squared edges to connect single notes can have a look to the threat: Can DOT produce a more structured graph?.

A problem that can occur by usage of dot2tex during PDF compilation (it is often the --shell-escape-flag problem). Have a look to the last link to find a solution if you use TexStudio.

Here are the example code and the corresponding figure:

\documentclass{standalone}
\usepackage[debug]{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
    \begin{dot2tex}[]
    digraph {
        rankdir=LR;
        pencolor=transparent;
        graph [splines=ortho];
        subgraph cluster1{
1->2->3->4->5;
}
subgraph cluster2 {
6->7->8->9->10.1;
}
subgraph cluster3 {
11->12->13->14->15;
}
subgraph cluster4 {
16->17->18->19->20;
}
subgraph cluster5 {
21->22->23->24->25
}
1->11;
3->21;
5->6;
1 [label="1-1"];
7->16;
}
    \end{dot2tex}
\end{document}

Ortho graph with subclusters