1. Dyadicity
There are various ways to assess whether the network is homophilic and to measure the relational dependency between the nodes. You could, for example, compute the ratio of same and cross label edges to get a feeling for their distribution.
A more advanced way is to measure the network's dyadicity and heterophilicity.
In fact, when there are two labels in a network, these two independent parameters are needed to capture the detailed interplay between the network structure and node properties.
In this lesson we focus on dyadicity.
2. Dyadicity
Dyadicity measures the connectedness between nodes with the same label.
As an example let's look at these two networks.
Both of them have 15 nodes, 9 that are white and 6 that are green.
Clearly, the distribution of the green and white nodes is different.
In the network on the left there are 7 edges between green nodes, but on the right, there are 3.
There is higher connectedness between green nodes in the network on the left.
3. Dyadicity
Dyadicity measures the number of same label edges compared to what is expected in a random configuration of the network, i.e. if the labels were randomly distributed.
So we need to compute the expected number of same label edges using combinatorics with this formula.
For the desired label, in this case, green, you count the number of possible edges connecting two green nodes, or n_ g choose 2 and multiply with the network's connectance, p, which as you recall is the probability of two nodes being connected.
In our example, there are 9 white nodes, 6 green nodes, and the connectance is 0.2, so the expected number of edges connecting green nodes is six times five times p divided by 2, which equals 3 as you see here.
Finally, you compute the dyadicity or D by dividing the actual number of same label edges with the expected number of same label edges, using this formula.
4. Dyadicity
Here you see the two networks from before.
The network on the left has dyadicity 2.33 and the network on the right has dyadicity 1.
5. Types of Dyadicity
As we said before, dyadicity is a measure of the actual number of same label edges in comparison to the expected number of same label edges.
Therefore we can distinguish three scenarios depending on the value of D.
If D is greater than 1 we say that the network is dyadic because nodes with the same label are more connected amongst themselves.
If D is (almost) equal to one, the distribution of the labels is the same as in a random network.
If D is less than 1 we say that the network is anti-dyadic since nodes with the same label are less connected amongst themselves
Here you can see three examples of label distribution in the same network and the corresponding value for D.
6. Dyadicity in the Network of Data Scientists
Let's compute the dyadicity in the network of data scientists.
You can compute dyadicity for either the R or the Python users.
On the right, you see the R code for computing the network's connectance, the expected number of R edges and the expected number of Python edges.
Furthermore, there is R code for the dyadicity of the R nodes and the Python nodes, denoted by dyadicityR and dyadicityP, respectively.
As you can see, both dyadicity values are greater than one which indicates that R users are more connected amongst themselves and the Python users are also more connected amongst themselves.
7. Let's practice!
The key takeaway from this lesson is that dyadicity is a measure of how well-connected nodes with the same label are.
Remember that as there are two labels, we can compute the dyadicity of each of them.
Now let's try some examples.