
目前,我正在尝试修复集群的x,因为它们似乎在四处移动,创建了一个杂乱的图。所有的子图都有rank=same和newrank=true。仅对于从一个簇到另一个簇的边,constraint值设置为true。
我尝试了http://martin-loetzsch.de/S-DOT/constraint.html中的许多选项,但都不能正常工作。有人知道为什么子图会像上面那样水平移动吗?
// layered_view
digraph layered_view {
bgcolor=transparent fontsize=8 nodesep=0.2 rankdir=TB splines=ortho
switch_1 -> lake [label="" color=gold4 constraint=True dir=both style=solid]
switch_1 -> lake [label="" color=chartreuse4 constraint=True dir=both style=solid]
switch_1 -> switch_2 [label="" color=gold4 constraint=True dir=both style=solid]
switch_1 -> switch_2 [label="" color=chartreuse4 constraint=True dir=both style=solid]
switch_1 -> azure_1 [label="" color=gold4 constraint=True dir=both style=solid]
switch_1 -> azure_1 [label="" color=chartreuse4 constraint=True dir=both style=solid]
switch_2 -> watson [label="" color=goldenrod4 constraint=True dir=both style=solid]
lake -> tsX [label="" color=chartreuse4 constraint=True dir=both style=solid]
lake -> ptX [label="" color=chartreuse4 constraint=True dir=both style=solid]
switch_1 -> dropBox [label="" color=chartreuse4 constraint=True dir=both style=solid]
switch_1 -> ptX [label="" color=gold4 constraint=True dir=both style=solid]
switch_1 -> tsX [label="" color=goldenrod4 constraint=True dir=both style=solid]
switch_1 -> watson [label="" color=goldenrod4 constraint=True dir=both style=solid]
// software
subgraph cluster_software {
bgcolor=green color=black concentrate=true fontsize=8 label=Software newrank=true rank=same splines=ortho
// applications
subgraph cluster_applications {
bgcolor=green color=black concentrate=true fontsize=8 label=Applications newrank=true rank=same splines=ortho
tsX [label=tsX color=black fillcolor=chartreuse1 fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
ptX [label=ptX color=black fillcolor=chartreuse1 fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
// cloud
subgraph cluster_cloud {
bgcolor=green color=black concentrate=true fontsize=8 label=Cloud newrank=true rank=same splines=ortho
azure_1 [label=azure_1 color=black fillcolor=darkolivegreen1 fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
dropBox [label=dropBox color=black fillcolor=darkolivegreen1 fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
}
// systems
subgraph cluster_systems {
bgcolor=green color=black concentrate=true fontsize=8 label=Systems newrank=true rank=same splines=ortho
// computing
subgraph cluster_computing {
bgcolor=green color=black concentrate=true fontsize=8 label=Computing newrank=true rank=same splines=ortho
"ex-uni" [label="ex-uni" color=black fillcolor=cadetblue fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
// sensors
subgraph cluster_sensors {
bgcolor=green color=black concentrate=true fontsize=8 label=Sensors newrank=true rank=same splines=ortho
watson [label=watson color=black fillcolor=blue fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
// storage
subgraph cluster_storage {
bgcolor=green color=black concentrate=true fontsize=8 label=Storages newrank=true rank=same splines=ortho
lake [label=lake color=black fillcolor=deepskyblue2 fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
}
// network
subgraph cluster_network {
bgcolor=green color=black concentrate=true fontsize=8 label=Network newrank=true rank=same splines=ortho
// switch
subgraph cluster_switch {
bgcolor=green color=black concentrate=true fontsize=8 label=Switch newrank=true rank=same splines=ortho
switch_1 [label=switch_1 color=black fillcolor=gold fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
}
// artifacts
subgraph cluster_artifacts {
bgcolor=green color=black concentrate=true fontsize=8 label=Artifacts newrank=true rank=same splines=ortho
switch_2 [label=switch_2 color=black fillcolor=white fixedsize=true shape=rectangle style=filled width=1.3 xlabel=""]
}
}发布于 2020-08-16 08:37:33
我还没有找到一种简单的方法来轻松地移动集群。这是一个可以做你想做的(我认为)并且不需要太多修改源码的kludge:
用/*注释掉你所有的边... */ (这些边导致了末尾的这些线条(以产生你想要的对齐方式):
switch_1 -> switch_2 -> watson style=invis watson -> {azure_1 tsX} style=invis
with -n选项以固定节点和集群并添加边
neato -n -Tpng mylile.dot >myfile.png
给予:

https://stackoverflow.com/questions/63421789
复制相似问题