How to draw linked list data structure in plantuml?

+1 vote
asked Feb 28, 2025 in Question / help by khrosofdsfov (160 points)

https://imgur.com/a/5lucFPX

I mean something like this. Linked representation of tree. I know how to form a tree but I don't know how to form a linked list in plantuml. I have never seen it.

2 Answers

+1 vote
answered Mar 2, 2025 by dickmaley (4,160 points)
selected Mar 3, 2025 by khrosofdsfov
 
Best answer

image

@startuml
<style>
arrow {
    FontColor transparent;
    FontName: Sans Serif;
    FontSize:: 14;
    FontStyle Bold
    LineColor red
    LineThickness: 2;
}
component {
    BackgroundColor: #aqua/white;
    'DiagonalCorner: 5;
    FontColor: Black;
    FontName: Sans Serif;
    FontSize: 14;
    FontStyle: Bold;
    HorizontalAlignment: left;
    LineColor: orange;
    LineThickness: 5;
    'minimumwidth:100;
    RoundCorner:25;
    'Shadowing: 3.0;
    Shadowing: 5; 
}
</style>
component [root]
component [A] As A
component [B] As B
component [C] As C
component [D] As D
component [E] As E

root ==> A : .
A ==> B:.
A ==> C:.
C ==> D:.
C ==> E:.
@enduml

Is this good enough?

Dick Maley

commented Mar 3, 2025 by The-Lu (87,240 points)

Hi all,

Here is another proposal, using simply mindmap, as:

@startmindmap
top to bottom direction
* root
** A
*** B
*** C
**** D
**** E
@endmindmap

Enjoy,
Regards,
Th.

0 votes
answered Mar 3, 2025 by The-Lu (87,240 points)

Hello K,

From your image input, here is another solution using JSON, as:

@startjson
{
"root": [[0, "B", 0], "A", [[0, "D", 0], "C", [0, "E", 0]]]
}
@endjson

Enjoy,
Regards,
Th.

commented Mar 3, 2025 by anonymous
Th

That looks like magic. Very impressive solution.
...