getting nodes in left-to-right order

Hi,

I would like to get the bottom nodes (labeled 0, 1, and 2) of the attached graph in the left-to-right order 0, 1, 2. I tried to achieve this with ordering=out, but it only works when I remove other nodes. Does anyone know how to do this right?

AttachmentSize
example_arg.txt8.96 KB

You basically had it right,

You basically had it right, but you want the attribute to only apply to the dummy node, not to a lot of nodes. So remove ordering=out from the subgraph sub and attach it to the dummy node.

Thanks, I changed the

Thanks, I changed the subgraph definition to

subgraph sub {
    C_30 [fillcolor="cyan" label=<
    <TABLE CELLSPACING="0" BORDER="0">
    <TR><TD BGCOLOR="grey87" WIDTH="1"></TD><TD PORT="N0" BGCOLOR="grey87" >"0"<BR/>AACC<BR/></TD><TD BGCOLOR="grey87" WIDTH="1"></TD></TR>
    </TABLE>>];

    C_24 [fillcolor="cyan" label=<
    <TABLE CELLSPACING="0" BORDER="0">
    <TR><TD BGCOLOR="grey87" WIDTH="1"></TD><TD PORT="N0" BGCOLOR="grey87" >"1"<BR/>AAAA<BR/></TD><TD BGCOLOR="grey87" WIDTH="1"></TD></TR>
    </TABLE>>];

    C_27 [fillcolor="cyan" label=<
    <TABLE CELLSPACING="0" BORDER="0">
    <TR><TD BGCOLOR="grey87" WIDTH="1"></TD><TD PORT="N0" BGCOLOR="grey87" >"2"<BR/>CCCC<BR/></TD><TD BGCOLOR="grey87" WIDTH="1"></TD></TR>
    </TABLE>>];

    dummy [ shape = plaintext, label="dummy", style = "", ordering = out ]
    dummy -> C_30
    dummy -> C_24
    dummy -> C_27
}

but I still get the bottom nodes in the left-right-order 2, 1, 0 and not 0, 1, 2.

Next question: what version

Next question: what version of graphviz are you running? You can find out by running dot -V. There was a problem with the ordering attribute a while back, which has now been fixed.

On my computer, dot -V

On my computer, dot -V gives

dot - graphviz version 2.26.0 (20091210.2329)

Is this too old?

I would certainly recommend

I would certainly recommend updating your version. There have been a lot of changes in the last 4 years, including the fix for the problem you are seeing.

By the way, if updating is not possible, you should be able to get a simlar effect by using rank=same for nodes 0, 1, 2 and then adding invisible edges 0->1->2 between them.

Recent comments