Search code examples
graphvizsubgraph

Multiple graphs and direction (rankdir) in one dot file (gvpack not doing what I want)


DISCLAIMER : I am French and so I am sorry in advance for my poor english. Please be nice, thank you very much.

So I have multiple files and graphs with different direction (rankdir). I must merge them to have one big coherent graph.

There is a part on the bottom with the classic toptobottom direction :

strict digraph G {
    compound = true
    ranksep = "1 equally"
    node [shape=box, style=rounded]    

    render [label="Rendu de l'image"]

    subgraph cluster_controle {
        label = "Contrôle qualité"
        {
            conformite[label="Conforme à la réalité : simulation visuelle"]
            mesure[label="Mesures factuelles"]
            fidelite[label="Fidélité de l'image"]
            perf[label="Performance"]
            nettete[label="Netteté de l'image"]

            nettete -> mesure
            fidelite -> mesure
            perf -> mesure
            mesure -> conformite
        }
    }
    render -> perf [lhead=cluster_controle]
}

Render of the code above. Main part of the whole graph.

Now I have two other parts : one that must go on the left of the main graph, and the other on the right.

Left :

strict digraph O {
    compound = true
    ranksep = "1 equally"
    rankdir=LR
    node [shape=box, style=rounded]
    subgraph cluster_opti {
        label = "Optimisation du calcul"
        tracking [label="Eye-tracking"]
        {
            rank=same
            fovea [label="Fovea rendering"]
            load [label="Equilibrage de charge"]
            denoiser [label="Denoiser"]
        }
        ia_denoise [label="IA"]

        fovea -> tracking
        load -> tracking
        denoiser -> tracking
        ia_denoise -> denoiser
    }
}

Left part of the graph

Right part :

strict digraph A {
    compound = true
    ranksep = "1 equally"
    rankdir=RL
    node [shape=box, style=rounded]
    subgraph cluster_precalcul {
        label = "Anticipation"
        precalcul [label="Précalcul des images"]
        {
            rank=same
            ia_mouv [label="IA (mouvements)"]
            caching [label="Caching"]
        }
        ia_mouv -> precalcul
        caching -> precalcul
    }
}

Right part of the whole graph

I tried gvpack -u but it does not do what I want. The direction (rankdir) of the lef and right part are not taken in account. I also tried gvpack -g or -n but there is the following error :

Error: node render in graph G has no position
Error loading layout info from graph G

And now my questions are :

  • Is it possible to merge them like I want to in one file ?
    • If yes, how to please ?
  • If it is not possible, do I really have to do it in Inkscape by hand ? sad face

Solution

  • try:

    • -array to combine as graphs (not clusters or nodes)

    • _i to combine the files in the order on the command line (not based on size)

    • 3 to request 3 "columns" of graphs (not a 2x2 grid)

      gvpack -array_i3  part*dot | neato -n2 -Tpng 
      

    [the gvpack man page can help if you need to alter justification or margins]

    Giving:
    enter image description here