Get startedGet started for free

Close relationships: assortativity & reciprocity

1. Close relationships: assortativity & reciprocity

2. Assortativity

Often in networks we are interested in the following question. Do vertices randomly associate with other vertices or do they preferentially associate with similar vertices? You may be interested for instance in whether children of the same gender are more likely to nominate each other as friends in a friendship network. You may be interested in whether individuals of the same political persuasion are more likely to reply to each other's tweets. Essentially these types of questions boil down to the age old question of "do birds of a feather flock together?". More formally in network analysis, the term "assortativity" is used to determine how likely two vertices that share some attribute in common are to be attached to each other. These attributes may be categorical such as political party or gender, but they may also be numerical such as age. As an example, the network pictured here shows associations between birds to field site in England. Each vertex is colored according to a measure of each bird's boldness. As you can see, bold birds in red tend to associate with each other. Shy birds in blues and greens tend to associate with other shy birds. This network therefore has high assortativity.

3. Assortativity

In igraph the function to calculate the assortativity of a network is assortativity(). The function takes two inputs. The first is the graph object. The second is a vector of attributes associated with each vertex. If the attributes are already numerical - an example in human networks might be the age of individuals or their income - then these values can be used directly. If the attributes are categorical such as gender or political party affiliation, then they need to be converted to numbers. This can be done straightforwardly by converting each attribute level to factor levels - 1, 2, 3 etc. In the example network here we have two categories - bold and shy. These would be converted to 1's for bold individuals and 2's for shy individuals. The value returned will range from -1 to +1. 0 indicates no overall pattern of preferential attachment. +1 would indicate individuals only attach to similar individuals, and a -1 would indicate that individuals actively avoid similar individuals. The value of 0.45 here is relatively high. To understand how meaningfully high, we would need to perform a randomization test. Another commonly calculated assortativity measure is degree assortativity. This assesses whether vertices with a high degree connect preferentially to other vertices with a high degree. In igraph, the function used is assortativity-dot-degree(). The first argument is the graph object and the second argument details whether the graph is directed or undirected. In this example, we have a negative value for the assortativity degree indicating that highly connected individuals do not connect preferentially to other highly connected individuals.

4. Reciprocity

Another measure of relationships' closeness in directed networks is reciprocity. The reciprocity of a directed network is equal to the proportion of edges that are symmetrical. That is, the proportion of outgoing edges that also have an incoming edge. In the example network, there are 20 edges. 8 of them are the only edge between two vertices. The edge from B to I is an example. The other 12 edges are in reciprocal relationships. There is an edge from J to K and from K to J. The reciprocity of this graph is therefore 0-point-6 as 60% of edges (12 out of 20) are in these reciprocal relationships. Reciprocity in igraph can be calculated using the reciprocity() function.

5. Let's practice!

Now it's your turn.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.