right arrow direction not preserved across groups

0 votes
asked Mar 23 in Question / help by tester (140 points)

I can't get the rendered graph to have node A on the left of B and node E on the left of F, even with the clear instruction of edge `A -right-> B` to have A connect to B with right arrow, and actual rendered image can be found using this tool: https://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIfAJIv9p4lFILLGSY_ABorGC5HIgEPI089enrW8xGIbdMEvQhamDHZ1DRX25Rg15Jegw1PbfcUKwDefE76v8ZXk81aWxShb1AQTkPo1D4ZS8JKl1UWc0000, and and rendered image is also attached. 

```
@startuml
rectangle "Group 1" {
    [A]
    [B]
    [C]
}

rectangle "Group 2" {
    [E]
    [F]
}

A -right-> B
E -right-> F
A --> E
B --> C
C --> F
@enduml
```

image

1 Answer

0 votes
answered Mar 23 by The-Lu (85,820 points)

Hello D.,

Here are some proposals, (but it depends of Graphviz version...)

@startuml
left to right direction

rectangle "Group 1" {
    [A]
    [B]
    [C]
}

rectangle "Group 2" {
    [E]
    [F]
}

A --> B
E --> F
A --> E
B --> C
C -> F
@enduml

Or:

@startuml
left to right direction

rectangle "Group 1" {
    [A]
    [B]
    [C]
}

rectangle "Group 2" {
    [E]
    [F]
}

A --> B
E --> F
A -l-> E
B -l-> C
C -> F
@enduml

If that can help,
Regards,
Th.

commented Mar 23 by tester (140 points)
reshown Mar 24 by tester

thanks a lot for your suggestions, this is minimized repro I extracted from a way bigger graph, and I've just tried the left to right direction layout, it comes with even more problems.

could you please help me understand why the original arrow layout is not honored?

for example: the first problem I'm encountering is with D node in group 1:

@startuml
rectangle "Group 1" {
    [A]
    [B]
    [C]
    [D]
}

rectangle "Group 2" {
    [E]
    [F]
}

A -right-> B
E -right-> F
A --> E
B --> C
B --> D

C --> F
D --> F
@enduml

I'd be getting this graph

PlantUML diagram

if I change it to left to right direction:

@startuml
left to right direction
rectangle "Group 1" {
    [A]
    [B]
    [C]
    [D]
    C-[hidden]->D
}

rectangle "Group 2" {
    [E]
    [F]
}

A --> B
E --> F
A -l-> E
B -l-> C
B -l-> D

C -l-> F
D -l-> F
@enduml

it's now even worse:

PlantUML diagram

...