how can I adjust direction of edge in dot diagram?
Before asking, I tried to search the answer for my question, buf I couldn't find. My question is about changing edge direction in dot diagram. Rankdir is 'LR', but in certain part of graph, I want to use 'TB'. Let me give an example.
digraph G { rankdir=LR; size="7,5"; browser->ui_thread; browser->db_thread; browser->webkit_thread; browser->cache_thread; browser->file_thread; browser->io_thread; io_thread[style=filled]; cache_thread[style=filled]; ui_thread->thread[label=inherit]; ui_thread->messageloo开发者_JAVA百科p[style=dotted]; db_thread->messageloop[style=dotted]; webkit_thread->messageloop[style=dotted]; cache_thread->messageloop[style=dotted]; file_thread->messageloop[style=dotted]; io_thread->messageloop[style=dotted]; }
it gives out graph like this
But, this is not what I want. I want the following image. "thread" is above "ui_thread" vertically.
You may think it can be solved easily using "rankdir=same" with "thread" and "ui_thread". I sure tried this already. but I failed. "thread" is always below "ui_thread".thanks,
Unfortunately, graph direction can only be specified once, and the whole graph stays in that direction. In this situation, you can usually get the desired effect with a combination of constraint=false
and invisible edges to force some ordering.
This code will produce your second image:
digraph G {
rankdir=LR;
size="7,5";
browser->thread[style=invis];
browser->ui_thread;
browser->db_thread;
browser->webkit_thread;
browser->cache_thread;
browser->file_thread;
browser->io_thread;
io_thread[style=filled];
cache_thread[style=filled];
ui_thread->thread[label=inherit constraint=false];
ui_thread->messageloop[style=dotted];
db_thread->messageloop[style=dotted];
webkit_thread->messageloop[style=dotted];
cache_thread->messageloop[style=dotted];
file_thread->messageloop[style=dotted];
io_thread->messageloop[style=dotted];
}
精彩评论