在graphviz中水平和垂直组织方框

在graphviz中水平和垂直组织方框,graph,graphviz,Graph,Graphviz,在某些情况下,有没有办法让方框水平显示,在另一些情况下则垂直显示?(见附件) 下面是我得到的代码和输出: 代码: /** ** Diagram representing the Simulator Engine **/ digraph G { graph [ rankdir = "TB" ]; /** ** The simulator engine rectangle **/ sub

在某些情况下,有没有办法让方框水平显示,在另一些情况下则垂直显示?(见附件)

下面是我得到的代码和输出:

代码:

/**
** 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";
                }

    }

}
/**
** 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";
                }

    }

}
输出:

/**
** 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";
                }

    }

}
/**
** 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";
                }

    }

}

显然这太长了。我想要的是将每个突触移动到它自己的线路中(我认为它在Graphviz术语中被称为“等级”)。显然,没有办法做到这一点,但有一个办法。因此,我采用上面相同的代码,并像这样引入不可见边

代码:

/**
** 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";
                }

    }

}
/**
** 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";
                }

    }

}
现在的产出看起来更具吸引力

输出:

但是现在突触盒之间有一个巨大的缺口。设置
nodesep=0.1
len=0.1
无效。谁能告诉我如何修复这个,或者如何重新设计这个

注意:如果有人想知道我为什么从1到2再到n,那是因为我计划在其中放一个椭圆,但我不知道怎么做……当我到达它时,穿过那座桥。

你正在寻找它-将这一行添加到图表的属性中:

ranksep = 0.1
以点为单位,这将给出所需的秩间隔(以英寸为单位)。这是 一列中节点底部之间的最小垂直距离 以及下一个节点中的节点顶部