A property very important in social networks, and to a lesser degree in other networks, is transitivity. If refers to the extent to which the relation that relates two nodes in a network that are connected by an edge is transitive. Perfect transitivity implies that, if $x$ is connected (through an edge) to $y$, and $y$ is connected to $z$, then $x$ is connected to $z$ as well. It is very rare in real networks, since it implies that each component is a clique, that is, each pair of reachable nodes in the graph would be connected by an edge.
However, partial transitivity is useful. In many networks, particularly social ones, the fact that $x$ knows $y$ and $y$ knows $z$ does not guarantee that $x$ knows $z$ as well, but makes it much more likely. The friend of my friend is not necessarily my friend, but is far more likely to be my friend than some randomly chosen member of the population.
In the context of social networks, three individuals $x, y, z$ such $x$ and $z$ are both friends of $y$ are called a triad centered at $y$. The triad is said open if the link from $x$ to $z$ is missing. A closed triad centered at $y$ is a particular triad centered at $y$ with the additional link from $x$ to $z$. The process of closing an open triad is called triadic closure. Transitivity coefficient $T$ for a network corresponds to the fraction of triads that are closed, that is the fraction of pairs of people with a common friend who are themselves friends, or equivalently, the mean probability that two people with a common friend are themselves friends. $T = 1$ implies perfect transitivity, i.e., a network whose components are all cliques. $T=0$ implied no closed triad, which happens for various topologies, such as a tree or a square lattice.
In the example below, for instance, there are 5 triads: one centered at $x$, one at $y$, and three at $z$. Three of them are closed triads (the ones on the triangle), and two are open (the ones centered at $z$ that include $w$). Hence the transitivity coefficient is $T = 3/5 = 0.6$.
Function transitivity, with parameter type = "global", computes graph transitivity in igraph.
Social networks tend to have quite high values of the transitivity coefficient. For instance, the transitivity coefficient of the computer science collaboration network is 0.24. This means that, on average, the chance that two scholars that share a common collaborator wrote a paper together is almost one-fourth. This is a rather high probability, indeed. As a comparison, the transitivity coefficient for a random network of the same size is $9.6 \cdot 10^{-6}$. This large discrepancy is a clear sign of real social effect at work in the context of academic collaboration: authors with a common collaborator have several good reasons to write a paper together, for instance they are probably working on very close topics or they scientifically know each other through the common collaborator.
However, non-social networks have lower transitivity coefficients. For the Internet, for example, the transitivity is much lower than expected. This suggests that in the Internet there are forces at work that shy away from the creation of triangles. In some other networks, such as food webs or the Web, transitivity is neither higher nor lower than expected.
Transitivity of a random network with edge probability $p$ is exactly $p$, and this is also the probability that any two random nodes are connected, which is unrealistic. Transitivity of a preferential attachment graph can be proved to be higher than for random graphs, although it vanishes as the size of the networks grows.
As for directed networks, the transitivity coefficient is computed as for undirected networks, but ignoring the direction of the edges. However, notice that, where on undirected graphs the smallest loop has length three, in a directed graph it has length two; it is a sequence $x,y,x$ such that the directed edges $(x,y)$ e $(y,x)$ belong to the graph. We can thus measure the frequency of loops of length two in a directed network, which is called reciprocity. It measures how likely it is that a vertex that you point to also points back at you. Formally, the reciprocity of a directed network is the fraction of edges that belong to a loop of length two, or: $$R = \frac{\sum_{i,j} A_{i,j} A_{j,i}}{\sum_{i,j} A_{i,j}} = \frac{\mathrm{Tr} (A^2)}{m} $$ where $m$ the the number of edges and $A$ the adjacency matrix of the graph and $Tr(X)$ is the trace of matrix $X$, that is, the sum of diagonal elements of $X$. Notice that $A_{i,j} A_{j,i} = 1$ if and only if $i$ links to $j$ and vice versa. For the Web, the reciprocity is about 57%, meaning that more than half of the links link back. For the network of who has whom in the email address book the reciprocity was found about 23%. Reciprocity is computed in igraph with function reciprocity. For instance, the reciprocity of the following graph with 18 edges is $6/18 = 1/3$.
The transitivity measures the density of loops of length three (triangles) in a network. We can also look at densities of other small groups of nodes, or motifs, and they are called (the reciprocity in directed networks was an example, in fact). For instance, in genetic regulatory networks and neural networks researchers have found certain small motifs that occurred far more often than expected on the basis of chance. They conjectured that these motifs were playing the role of functional circuit elements, and that they might be an evolutionary result of their usefulness to the organisms involved.