Assume we have a group of 10 business engineering students working on a group project. Some of them follow data analytics (DA) and the others operations research (OR). They all belong to one of the two groups: DA or OR. These students sometimes collaborate when they are working on a group project. They can therefore be linked together to form a network. In this case, two students are connected if they are currently working together. As a result we have three types of edges in the network:
Before we can calculate dyadicity and heterophilicity, we first need to compute
some other properties. First, we need to calculate the number nodes in each group
and the number of edges in each group.
N <- length(V(g))
n_da <- length(which(V(g)$master=='DA'))
n_or <- length(which(V(g)$master=='OR'))
M <- length(E(g))
m_dd <- length(which(E(g)$label=='dd'))
m_oo <- length(which(E(g)$label=='oo'))
m_do <- length(which(E(g)$label=='do'))
The connectedness of the network is the probability of two nodes being connected. It is obtained by dividing the actual number of edges, M, with the number of edges if the network was fully connected.
p <- 2*M/(N*(N-1))
Note that this is the same as:
graph.density(g)
Assume we have a group of 6 students: Tom, Sofie, Arno, Jan, Karen and Laura. Assume that Tom, Sofie and Arno are business engineering (B) students, while Jan, Karen and Laura are studying economics (E). They all belong to one of the two groups: B or E. All 6 students are going on an exchange programme next semester. Therefore, the students can be linked together based on the destination that they are going to:
Destination | Student 1 | Student 2 |
---|---|---|
France | Tom | Arno |
Switzerland | Sofie | Jan |
China | Karen | Laura |
As a result we have three types of edges in the network:
Calculate the number of nodes that represent business engineering
students, and store it as n_b
.
Calculate the number of edges that link business engineering students and
economics students, and store it as m_be
.
Calculate the connectedness of the network by using the formula seen
above, and store it as p
.
Assume that:
StudentsNetwork
from the first exercise is given, as well as the variables
names
, master
, Students
, and g
.