Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I represent a Python dictionary in UML?

Tags:

python

uml

I would like to know how I can represent a Python dictionary using UML. This dictionary is an attribute of a class called Digraph. The keys are of type Node, and the values are of type Edge.

like image 386
lmiguelvargasf Avatar asked Oct 19 '25 02:10

lmiguelvargasf


1 Answers

Qualified associations are useful for modeling maps/dictionaries.

See uml-diagrams.org for some examples.

You can also read the official UML (2.5) specs (see page 215)

And your particular problem can be represented as:

enter image description here

However note that this is only for nodes with single outgoing edges (its one-to-one mapping); if this wasn't your intention than the mapping would have to be Node to array of Edges. (and changing 1 into *).

like image 74
Peter Uhnak Avatar answered Oct 21 '25 16:10

Peter Uhnak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!