Можно ли в некоторых случаях отображать прямоугольники по горизонтали, а в других по вертикали?(см. связанный вопрос ).
Вот код и вывод, который я получаю:
код:
/**
** 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";
}
}
}
Вывод:
Очевидно, что это слишком долго.Я хочу переместить каждый синапс в отдельную строку (я думаю, это называется «ранг» в Graphviz-jargon).По-видимому, сделать это невозможно, но есть трюк .Поэтому я беру тот же код выше и представляю невидимые ребра, такие как
код:
/**
** 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, то это потому, что я планирую поместить туда эллипсы, ноЯ понятия не имею, как это сделать ... перейти этот мост, когда я доберусь до него.