2012-02-01 34 views
6

Bazı durumlarda ve diğerlerinde dikey olarak kutularda yatay olarak görünmenin bir yolu var mı? (bakınız related question).Kutuları yatay olarak ve sonra dikey olarak dikey olarak düzenleyin

kod:

/** 
** Diagram representing the Simulator Engine 
**/ 
digraph G { 
     graph [ 
      rankdir = "TB" 
     ]; 

     /** 
     ** The simulator engine rectangle 
     **/ 
    subgraph cluster_simulator_engine { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     label = "Simulator Engine"; 

       /** 
       ** The first topology 
       **/ 
       subgraph cluster_T1 { 
         color=white; 
         node [style=filled]; 

         /** 
         ** The n^th neuron 
         **/ 
         subgraph cluster_T1_N3 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron n"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N3_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N3_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N3_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 

         /** 
         ** The second neuron 
         **/ 
         subgraph cluster_T1_N2 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 2"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N2_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N2_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N2_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 


         /** 
         ** The third neuron 
         **/ 
         subgraph cluster_T1_N1 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 1"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N1_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N1_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N1_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 


         label = "Topology 1"; 
       } 

       /** 
       ** The second topology 
       **/ 
       subgraph cluster_T2 { 
         color=white; 
         node [style=filled]; 

         /** 
         ** The n^th neuron 
         **/ 
         subgraph cluster_T2_N3 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron n"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N3_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N3_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N3_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 

         /** 
         ** The second neuron 
         **/ 
         subgraph cluster_T2_N2 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 2"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N2_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N2_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N2_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 


         /** 
         ** The third neuron 
         **/ 
         subgraph cluster_T2_N1 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 1"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N1_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N1_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N1_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           /*"T1_N1_S3" -> "T1_N1_S2" [style=invis];*/ 
         } 


         label = "Topology 2"; 
       } 

    } 

} 

Çıktı:

First Diagram

Açıkçası bu kadar çok uzun

İşte alıyorum kod ve çıkıştır. İstediğim şey, her bir sinapsın kendi satırına taşınmasıdır (bence buna Graphviz-jargon'da 'rank' denir). Görünüşe göre, bunu yapmanın bir yolu yok, ama bir trick var. Bu nedenle, yukarıdaki aynı kodu alıp böylece

kodu gibi görünmez kenarları tanıtmak:

/** 
** Diagram representing the Simulator Engine 
**/ 
digraph G { 
     graph [ 
      rankdir = "TB" 
     ]; 

     /** 
     ** The simulator engine rectangle 
     **/ 
    subgraph cluster_simulator_engine { 
     style=filled; 
     color=lightgrey; 
     node [style=filled,color=white]; 
     label = "Simulator Engine"; 

       /** 
       ** The first topology 
       **/ 
       subgraph cluster_T1 { 
         color=white; 
         node [style=filled]; 

         /** 
         ** The n^th neuron 
         **/ 
         subgraph cluster_T1_N3 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron n"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N3_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N3_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N3_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T1_N3_S1" -> "T1_N3_S2" [style=invis]; 
           "T1_N3_S2" -> "T1_N3_S3" [style=invis]; 
         } 

         /** 
         ** The second neuron 
         **/ 
         subgraph cluster_T1_N2 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 2"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N2_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N2_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N2_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T1_N2_S2" -> "T1_N2_S3" [style=invis]; 
           "T1_N2_S1" -> "T1_N2_S2" [style=invis]; 
         } 


         /** 
         ** The third neuron 
         **/ 
         subgraph cluster_T1_N1 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 1"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T1_N1_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T1_N1_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T1_N1_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T1_N1_S1" -> "T1_N1_S2" [style=invis]; 
           "T1_N1_S2" -> "T1_N1_S3" [style=invis]; 
         } 


         label = "Topology 1"; 
       } 

       /** 
       ** The second topology 
       **/ 
       subgraph cluster_T2 { 
         color=white; 
         node [style=filled]; 

         /** 
         ** The n^th neuron 
         **/ 
         subgraph cluster_T2_N3 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron n"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N3_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N3_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N3_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T2_N3_S1" -> "T2_N3_S2" [style=invis]; 
           "T2_N3_S2" -> "T2_N3_S3" [style=invis]; 
         } 

         /** 
         ** The second neuron 
         **/ 
         subgraph cluster_T2_N2 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 2"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N2_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N2_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N2_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T2_N2_S1" -> "T2_N2_S2" [style=invis]; 
           "T2_N2_S2" -> "T2_N2_S3" [style=invis]; 
         } 


         /** 
         ** The third neuron 
         **/ 
         subgraph cluster_T2_N1 { 
           color=lightgrey; 
           node [style=filled]; 
           label = "Neuron 1"; 

           /** 
           ** The n^th synapse 
           **/ 
           "T2_N1_S3" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse n" 
           ]; 

           /** 
           ** The second synapse 
           **/ 
           "T2_N1_S2" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 2" 
           ]; 

           /** 
           ** The first synapse 
           **/ 
           "T2_N1_S1" [ 
            style=filled 
            shape=box 
            color=white 
            label="Synapse 1" 
           ]; 

           "T2_N1_S1" -> "T2_N1_S2" [style=invis]; 
           "T2_N1_S2" -> "T2_N1_S3" [style=invis]; 
         } 


         label = "Topology 2"; 
       } 

    } 

} 

ve çıkış artık daha çekici görünüyor.

çıkışı: Second smaller diagram

Ama şimdi sinaps kutuları arasında büyük bir boşluk vardır. nodesep=0.1 veya len=0.1 ayarlarının hiçbir etkisi yoktur. Bunu nasıl düzelteceğimi veya nasıl yeniden tasarlayabileceğimi söyleyen var mı?

NOT: Birisi neden 1'den 2'ye n'ye gittiğimi merak ediyorsa, bunun nedeni bir elipsin orada durmasını planlıyorum, ama bunu nasıl yapacağımı bilemiyorum. ona. Bu aradığınız ranksep var

cevap

8

- grafik için öznitelikler için bu satırı ekleyin: Nokta,

ranksep = 0.1 

, bu inç olarak, istenen rütbe ayrımı verir. Bu, numaralı sıradaki düğümlerin alt kısmı ve sonraki düğümlerin üst kısımları arasındaki minimum dikey mesafedir.

İlgili konular