scitools.com

← Graph catalog

UML Sequence Diagram - Custom is one of the interactive graphs Understand can draw of your code — call trees, dependencies, control flow, and more.

UML Sequence Diagram - Custom

Languages: Any
Targets: Functions
A plugin version of the UML Sequence Diagram

The UML Sequence Diagram in Understand is drawn with a custom layout algorithm, not Graphviz. This graph demonstrates how to use the otherwise undocumented layout algorithm. It can be used as a basis for customizing the UML Sequence Diagram.

UML Sequence Diagram Layout

Consider a simple UML Sequence Diagram that just contains a single activation:


The black circle on the left is the "Found Message", the beginning of the graph. It connects to an activation box for the initial function. The function belongs to the object "Object". Representing this graph in a simplified Graphviz dot format would be something like this

    digraph "name" {
      foundmessage -> activation [label="activation"];
      object -> activation;
    }
    

The problem for the layout algorithm is how to know which node is the found message, drawn directly to the left of the activation node, and which node is the object node, drawn directly above it. Because the model generation code and the layout code where initially combined, the layout relies on the model to say where the items are. Specifically, the attributes "row" and "col" are nearly always required.

The following image shows where the rows and columns are. Note that row and column are not final positions. They just place all the objects onto a grid. Also, not all objects are necessarily drawn. Rows 4 and 9 are defined by return edges that are not visible in the final graph. Row 8 isn't defined at all, but it's absence signals the end of the cluster.


There are three other attributes unique to the layout to be aware of:

In addition to the than the five attributes described above ("row", "col", "uml", "nesting" and "visible"), the layout supports a few Graphviz attributes. They are:

A list of possible "uml" values are below. Note that unlike the Graphviz shape attribute, values of "uml" cannot appear just anywhere. The layout algorithm will not work if items do not appear as expected. The possible values of "uml" are:

This variant is a plugin. It can be enabled/disabled from the Plugin Manager.