2016-08-25 5 views
1

Si je lance graphviz sur ce digraphe:Comment empêcher graphviz de dessiner des arêtes sur des étiquettes?

digraph G { 
    subgraph cluster_0 { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     a0; a1; a2; a3; 
     label = "sources"; 
    } 

    subgraph cluster_1 { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     b0; b1; b2; b3; 
     label = "intermediaries"; 
    } 
     a0 -> b0; a1 -> b0; 
     a0 -> b1; a1 -> b1; 
     a2 -> b2; b0 -> b2; 
     b1 -> b2; a3 -> b3; 
     b0 -> b3; b1 -> b3; 
} 

Je reçois

enter image description here

avec de nombreux bords coupent l'étiquette des "intermédiaires". Comment obtenir graphviz pour que les bords évitent les étiquettes de la même façon qu'ils évitent les nœuds de graphes?

Répondre

2

Pour contourner ce problème:

digraph G { 
    subgraph cluster_0 { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     a0; a1; a2; a3; 
     label = "sources"; 
    } 

    subgraph cluster_1 { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     nodelabel [label="intermediaries"; style=filled; color=lightgrey] 
     nodelabel -> b1 [style=invis]; 
     nodelabel -> b0 [style=invis]; 
     b0; b1; b2; b3; 
    } 
     a0 -> b0; a1 -> b0; 
     a0 -> b1; a1 -> b1; 
     a2 -> b2; b0 -> b2; 
     b1 -> b2; a3 -> b3; 
     b0 -> b3; b1 -> b3; 
} 

produits:

output

+1

C'est une solution de contournement, mais elle introduit un niveau supplémentaire et met l'étiquette à ce niveau, que je ne l'ai pas fait vouloir faire. Encore, +1 pour l'effort. – einpoklum