# Modelling Theory and Practice/Modelling with Components
## Introduction

* The concept of Graph is basic for representation of 2-ary relations among constants or variables.
* Keeping the overview in complex graphs by dividing them into components.
* The basic notion of component can be generalised in two ways:
** wrt. the strength of connection between components (connectivity), what leads to coupling and cohesion
** wrt. what outside elements a component relates to (modularisation), what leads to the concept of interface

### Example

Binary relation, n-ary relation.
* Semantic nets

## Constant vs Variable

Two meanings of a node:
* constant: a car, "Max Meier drives the car GO-123-FX".
* variable: any car, "Person drives Car", but of a certain kind (person, car, ...)

## Graph

| | 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | | X | | | X | |
| 2 | X | | | | X | |
| 3 | | X | | X | | |
| 4 | | | X | | X | X |
| 5 | X | X | | X | | |
| 6 | | | | X | | |
It is basic to understand the concept of graph. We just briefly point out some of the relevant notions here:
Such a relation among a set of elements can be denoted in matrix form or as a diagram. In most cases the diagram gives the reader a better understanding of the relation. Notice that this soleley a visual effect, since logicallly there is no difference.
Moreover, graphs don't have to be symmetric, as the one above, and also their elements are allowed to have edges from and to itself.
Thus the concept of graph, gives the formal basis for dealing with relations in modelling. For a more precise and comprehensive introduction to graph theory, go to graph (wikipedia).
There is also a more computational view on graphs, seen as a data type and performing operations on it, however this is NOT our concern here.

## Structuring by Components

Subdividing graphs into components is the fundamental idea of structuring them. However, we need to soften the concept of component a bit in order to make it really useful. Moreover, components can be divided into sub-sub-sub...components, so we discuss some rules of thumb where to stop this subdivision.

### Example

Street map: 3 villages -> break down to 3 maps (of each village)

### Component

A component is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the supergraph.
EXAMPLE
On one hand this concept of component is very clear, on the other hand it's not very useful. In order to cover cases as the above example (maps, streets, villages) the component concept needs to be generalised in the following way:
Component wrt connectivity
Connectivity asks for the minimum number of elements (nodes or edges) which need to be removed to disconnect the remaining nodes from each other. Related concepts: sparse vs strong graphs, Algebraic connectivity.
Further concepts:
* Cohesion
* Coupling
PS Another generalisation is the concept of module, see Types.

## Interface
### Components of a Component

"Small" components -> bite size (soft concept, explain by experience)

### Modules

* In a module each vertex $v\not \in X$, either every member of X is a non-neighbor of v or every member of X is a neighbor of v.. Modules lead to entity types.

## Literature

* Kleppe, Anneke (2009). Software Language Engineering. Addison-Wesley. ISBN 978-0-321-55345-4.