1

I've been trying to figure for the life of me how to get this graph looking how I like it. Here's the closest I've gotten

enter image description here

and it has been achieved with this code

@startuml
:A;
split;
  -> A to B;
  :B;
  -> B to E;
  :E;
  -> E to G;
split again;
  -> A to C;
  :C;
  ->C to D;
  :D;
  ->D to F;
  :F;
  ->F to G;
end split;
:G;
@enduml

But it's missing an arrow from C to F and I can't for the life of me figure out how to make it in the new syntax.

I did manage to do something like that with the old syntax like this

@startuml
"A" -left->["A to B"] "B"
"A" -right->["A to C"] "C"
"B"-->["B to E"] "E"
"C"-->["C to D"] "D"
"D"-->["D to F"] "F"
"C"-->["C to F"] "F"
"F"-->["F to G"]"G"
"E"-->["E to G"] "G"
@enduml

which results in this image

enter image description here

But this one has the drawbacks of being old syntax and I personally find the "rectangular" look produced by the new syntax much more readable than the curved lines of the old.

So, how to get an arrow from C to F in the new syntax? Some of the questions, like How to reference earlier activity in PlantUML UML Activity Diagram have gotten me close, but they don't quite seem to be what I'm looking for. I also looked into graphViz, but I couldn't figure out how to produce the same kind of clean squared up look that the new plantUML syntax gave me, so that's a bust as well. So, help?

EDIT: I noticed there were mistakes in my labeling, I have hopefully now fixed it and in terms of logical connections, both images shhould now be equivalent. I also added the red arrow and the label on paint to more clearly display what I want to achieve. Thank you to everyone who voiced their confusion, situation should now be much more clear.

Narmondur
  • 111
  • 1
  • 2
  • 7
  • I'm confused about the two diagrams. For the the first, you say you want an arrow from C to F; yet in the second, there's an arrow from B to E (which appears to bypass D). – Fuhrmanator Mar 07 '23 at 15:30
  • thank you @Fuhrmanator for pointing this out. The question has now been edited, hopefully it helped clear up the confusion – Narmondur Mar 07 '23 at 19:17

1 Answers1

1

In an activity diagram, you can show a bypass by using split. However, you can't because there's no extra activity on the flow that bypasses the activity. So, that seems like a conditional flow. Activity diagrams have a syntax (with diamond nodes) so this is how it looks:

@startuml diagram name
:A;
split;
  -> A to B;
  :B;
  -> B to E;
  :E;
  -> E to G;
split again;
  -> A to C;
  :C;
    if (condition?) then
    :D;
    endif
  :F;
  ->F to G;
end split;
:G;
@enduml

enter image description here

If you're just trying to get a graph, then maybe a state diagram is better (it's your second example, which I admit I don't understand the bypass -- it's not the same as the first example). Anyway, removing the left and right specifications usually makes for a better layout. I always start with that. Here's your second example (is it better?) without those:

@startuml
"A"-->["A to B"] "B"
"A"-->["A to C"] "C"
"B"-->["B to E"] "E"
"C"-->["C to D"] "D"
"D"-->["D to F"] "F"
"C"-->["C to F"] "F"
"F"-->["F to G"] "G"
"E"-->["E to G"] "G"
@enduml

enter image description here

Fuhrmanator
  • 11,459
  • 6
  • 62
  • 111