Entity Modelling

www.entitymodelling.org - entity modelling introduced from first principles - relational database design theory and practice - dependent type theory


Modelling Graphs

In this section we discuss various ways of representing directed graphs, the different shapes that their entity models can take and the different organisations of information implied by the different shapes.

Directed Graphs

There is a reliance here, in this presentation, on the use of the work ‘abstract’ and on an understanding of what the mathematician means by this. The best that I can offer as explanation is that the mathematical idea of an abstract structure is that of a set of individuals and relations independent of any particular representation of the individuals and the mathematical concepts of graph and directed graph are cases in point. In the case of a graph the individuals are notionally vertices and edges and the relations are the incidence relations between them. Paradoxically, with regard to any particular abstract structure, to describe it we need some kind of representation even though what we seek to describe is something without any particular representation. Mathematican Robin Gandy describes this to a non-mathematical audience in a lecture ‘Structure in Mathematics’1; he draws the love relationships to be found in Iris Murdoch's novel Severed Head as a directed graph and in a later section later I draw an equivalent graph (figure 8). If we abstract a directed graph from this then there are no labels, no lines, no points on paper just the facts of a set of notional individual entities and the relationships between them2.

We gave one model of a directed graph earlier as an example of a conjunctive dependency it is reproduced below in figure 14.

Figure 14
The model of a directed graph.

ER Models of Directed Graph

Viewing figures and following on from figure we see that there are two further ways of modelling directed graphs. These are shown in figure 15 and 16.

Figure 15
Directed Graph ER Model (ii)
Figure 16
Directed Graph ER Model (iii)

Though we have given three ways of modelling directed graphs note that mathematically there is only a single concept. The different models represent different ways of localising and communicating the information content of a graph. The models in figures 15 and 16 vary the incidence relationships between edges and vertices between categories reference and composition. If both are made composition then we get a further variation which is shown in figure 14.

We mentioned in chapter one that information is usually hierarchically communicated whereas with double composition relationships there is not one hierarchy but two hierarchies. Information must be double communicated once in each hierarchical form. For linear, hierarchical communication the above model is therefore replaced by one in which both hierarchies are represented as shown in figure 17.

Figure 17
Directed Graph ER Model (v)

Modelling Graphs and Symmetric Relationships

We use the unqualified term graph to mean a set of vertices and a set of undirected connections or edgess between them. To the mathematician the definition is straightforward but to the entity modeller it is less so and is somewhat unsatisfying. There is a difficulty and this difficulty lies at the heart of entity modelling. An understanding of the difficulty reveals simultaneously a gap in the entity relational approach by comparison with the mathematical approach but also an affinity between it and the means of language and communication.

To model a bidirectional graph is to add a reverse relationship to any of the models of a directed graph. If we start from figure 15 then we get this model:

In this model we have greyed out the to relationship to show that it has become redundant. This is because the vertex that an exit leads to is always the same vertex that its reverse leads from.


1In Structuralism, edited by D. Robey, Wolfson College Lectures, 1972.
2According to Gandy: This indifference to form of representation is what Bertrand Russell referred to when he said that in mathematics we are not interested in what we are talking about. We return to the subject abstraction versus representation in a later section.