3
votes

Suppose I have math algorithm e.g.

A = B + C
C = D + E
F = B + D

I would like to draw a diagram to represent it and the flow of the algorithm i.e. people know how the value of A calculate. Is there tool or the name of UML diagram that I can take a look?

3
IMHO, A = B + C is already a very good depiction of an algorithm... But of course, there are no lines to depict the flow. Why don't you just add them, why do you need some over standardized thing like UML? Draw some circles around "C" connect them with "D + E" ... done ;) - Dodo
But when the number of equals are getting more and more. It is hard to know say if the value of B is changed, which fields are changed as well? - Michael D

3 Answers

1
votes

Maybe a Dataflow Diagram?

Something like this:

dataflow diagram example

It's not part of UML, but can be a very useful way to show computation.

hth.

1
votes

UML diagrams are either about static structure (classes/components/packages) or interaction between entities (activity/sequence diagrams/state machines).

Algorithms or algorithm design are not covered by UML (very much like any other type of concrete method specification).

1
votes

There is an proposal to supplement UML diagrams by the diagrams called KOPENOGRAM. Which rather on data flow focus on algorithmical structure, conditions, loops, etc. As this is an proposal, limited specific tools exist to generate or draw kopenograms from source code (AFAIK there are Java plugins for BlueJ or NetBeans). However, Excel or any spreadsheet app might be used to make table and borders.

Your example will look like:

enter image description here

No dependency is shown on operations as in previous example, as this is task rather for compiler.