How to produce this simple dot graph (graphviz) with plantuml ?

0 votes
asked Oct 25, 2022 in Question / help by kasra (960 points)

Hi,

Could you please tall me How to produce this simple graph with plantuml ?

digraph G{

     nodesep = 0.25

     layout=dot     

     a [shape=rectangle width=5 ]

     b [shape=rectangle width=2]

     c [shape=rectangle width=5]  

     d [shape=rectangle width=12.5 constraint=false]     

     b-> d [style="invis"]   

}

https://edotor.net/?engine=osage#digraph%20G%7B%0A%20%20%20%20%20nodesep%20%3D%200.25%0A%20%20%20%20%20layout%3Ddot%20%20%20%20%20%0A%0A%20%20%20%20%20a%20%5Bshape%3Drectangle%20width%3D5%20%5D%0A%20%20%20%20%20b%20%5Bshape%3Drectangle%20width%3D2%5D%0A%20%20%20%20%20c%20%5Bshape%3Drectangle%20width%3D5%5D%20%20%0A%20%20%20%20%20d%20%5Bshape%3Drectangle%20width%3D12.5%20constraint%3Dfalse%5D%20%20%20%20%20%0A%20%20%20%20%20b-%3E%20d%20%5Bstyle%3D%22invis%22%5D%20%20%20%0A%0A%7D

1 Answer

0 votes
answered Oct 27, 2022 by The-Lu (63,000 points)

The simple way:

  • Why not using GraphViz/dot directly on PlantUML?
    As:
Regards.

commented Oct 27, 2022 by kasra (960 points)

Hi,

The purpose of this post was to give a simple dot graph, which is hard to achieve with plantuml ( I would love to be wrong here ! )  to highlight the difficulties to have so some sort of deterministic layout. ( determinist layout seems to be a difficult topic  in some cases)

Anyway, a better way of asking the question could have been : 

"How to produce this layout with class diagram  ?"

Meaning changing the rectangle just with "class" for example...

That's why I posted also on the forum this question

What is the mapping between Plantuml diagrams and Graphiz Layout (dot, neato, circo...) ?

In Graphviz,  layout engines express the different types of projection.

For example, the nop (nop1) nop2 flag in graphviz can be used when we explicitly give positions.

But as far as I know, in Plantuml we have these controls to play with the layout

plus all the tricks explain here
It seems that we can't give positions, and we can't give a specific width to a particular node.
(The latter was enough to have what I asked with the help of the edges)
So I am stuck lol ;-) .
Thanks for your suggestion , I read the document
It's more a wrapper than integration right ?
Indeed,  the Following is OK
@startuml
digraph foo {
 PlantUML -> Dot [label=use];
}
@enduml
But this is not 
@startuml
class a
digraph foo {
 PlantUML -> Dot [label=use];
}
@enduml
Please correct me If I am wrong.
Any missed documentation or technical info is greatly welcomed.
Finally I ask the better question : 
"How to produce this layout with class diagram  ?"
Thanks
Best Regards,
Kasra
commented Oct 29, 2022 by kasra (960 points)
edited Oct 29, 2022 by kasra

@ The-Lu

Do you have an example of diagram that combines plantuml and dot ?

For example a "class" or an "interface" that points to a graphviz  node ?

I am not able to find the right syntax.

Thanks

commented Oct 29, 2022 by The-Lu (63,000 points)

Hello K.,

Thanks for your precisions.

Here is a minimal example:

@startuml
class a
label l [
{{
digraph foo {
 PlantUML -> Dot [label=use];
}
}}
]
@enduml


But the 2 are independent, and cannot be connected.

If that can help,
Regards.

commented Oct 31, 2022 by kasra (960 points)
Thanks a lot ;-) !!
...