# How to read a DSM?¶

A DSM, or Dependency Structure Matrix, is a great way to display dependencies or interfaces between entities. A DSM is closely related to the adjacency matrix of a graph. A graph or network with nodes (entities) and edges (interfaces) is a more common and perhaps more intuitive representation of data, although a graph tends to lend itself less for the visualization and inspection of discrete data when things start to grow.

## Example graph¶

Let's consider an example graph:

```
graph LR
A --> B
A --> C
C --> A
B --> D
```

Here you can see dependencies between four entities: `A`

, `B`

, `C`

, and `D`

.

`A`

is input to`B`

and`C`

.`C`

provides input back to`A`

.`B`

provides input to`D`

.

## Corresponding DSM¶

The corresponding DSM of this would be:

### Matrix axis: nodes¶

The nodes are displayed on both axis, always in identical order (`A`

, `B`

, `C`

, `D`

) from the top-left to the bottom-right, with their rows and columns numbered from 1 onwards.

### Matrix dots: edges¶

- The
*inputs*of a node, or its incoming edges are displayed in its*row*. - The
*outputs*of a node, or its outgoing edges are therefore displayed in its*column*. - You can interpret the diagonal as the "self" of a node.
- Any self-loops could be displayed here.
- It is often greyed out for readability purposes.

For instance the blue dot in the first row (`A`

) in the third column (`C`

) corresponds to the arrow from `C`

to `A`

.

Info

This is called the *IR/FAD* convention, or *Inputs in Rows/Feedback Above Diagonal*. Note how the *feedback* from `C`

to `A`

is above the diagonal if you were to interpret the nodes on the axis as the steps of a process, for example.

Sometimes the transpose matrix is used (*IC/FBD*), but it is far less common and we usually stick to IR/FAD whenever we can.

So for the given dependencies in the graph's description that corresponds to:

`A`

is input to`B`

and`C`

: column 1 to row 2 and 3.`C`

provides input back to`A`

: column 3 to row 1.`B`

provides input to`D`

: column 2 to row 4.