防止graphviz重新排列节点 [英] Preventing graphviz from rearranging nodes

查看:85
本文介绍了防止graphviz重新排列节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用graphviz可视化树结构,问题是随着图形变大,graphviz开始重新排列节点的顺序.说我有以下内容,

I am trying to visualize a tree structure using graphviz, problem is as the graph gets bigger graphviz starts to rearrange the order of the nodes. Say I have the following,

  A
/ | \
B C D

它变成了

  A
/ | \
B D C

这样做可能是为了节省空间,但是按照节点的上下文顺序,我尝试添加的问题很重要,

it probably does this to save space but in my context order of the nodes matter I have tried adding,

graph [ordering="out"];

但是它并没有改变输出.

but it did not change the output.

digraph bt {
graph [ordering="out"];
node [style="rounded", shape=box]
N_2386 -> N_2387
N_2387 -> N_2388
N_2388 -> N_2389
N_2388 -> N_2390
N_2387 -> N_2391
N_2386 -> N_2392
subgraph cluster_2393 {
labeljust = "l";
style=dashed;color="#B0B0B0"
N_2392 -> N_2394
N_2394 -> N_2395
N_2395 -> N_2396
N_2396 -> N_2397
N_2397 -> N_2398
N_2397 -> N_2399
N_2396 -> N_2400
N_2400 -> N_2401
N_2400 -> N_2402
N_2395 -> N_2403
N_2403 -> N_2404
N_2404 -> N_2405
N_2405 -> N_2406
N_2403 -> N_2407
N_2407 -> N_2408
N_2408 -> N_2409
N_2409 -> N_2410
N_2410 -> N_2411
N_2411 -> N_2412
N_2412 -> N_2413
N_2412 -> N_2414
N_2412 -> N_2415
N_2411 -> N_2416
N_2416 -> N_2417
N_2416 -> N_2418
N_2416 -> N_2419
N_2408 -> N_2420
N_2408 -> N_2421
N_2403 -> N_2422
N_2395 -> N_2423
N_2392 -> N_2424
}
}

有问题的图形我需要的是,N_2387应该在右侧N_2392应该在左侧.我插入它们的顺序是什么.

graph in question What I need is, N_2387 should be on the right N_2392 should be on the left. Which is the order I insert them.

推荐答案

我尝试了以下

digraph g {
  ordering=out ;
  node [shape=box] ;

  a -> b ;  a -> c ;  a -> d ;  a -> e ;  a -> f ;
  a -> g ;  a -> h ;  a -> i ;  a -> j ;  a -> k ;
  a -> l ;  a -> m ;  a -> n ;  a -> o ;  a -> p ;
  a -> q ;  a -> r ;  a -> s ;  a -> t ;  a -> u ;
  a -> v ;  a -> w ;  a -> x ;  a -> y ;  a -> z ;
}

和所有节点b-z以正确的顺序位于同一级别. 您使用的是什么版本?

and all nodes b-z are on the same level in the correct order. What version are you using?

这篇关于防止graphviz重新排列节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆