centrality_factor {CurricularAnalytics} | R Documentation |
Calculate centrality
Description
A helper function for calculating the centrality for each node.
Usage
centrality_factor(node_list, edge_list)
Arguments
node_list |
Dataframe with an 'id' column for each node and a 'term' column specifying which term the course is to be taken in. |
edge_list |
Dataframe with two columns 'from' and 'to' specifying
directed edges starting at 'from' nodes directed towards 'to' nodes. Entries
must use node ids from |
Details
A course is considered central if it has many requisite edges flowing in and
out of the node. More formally it is the number of long paths that include the
node. That is, consider a curriculum graph G_c
and a vertex v_i
. A
long path is a path that satisfies the following conditions:
-
v_i,v_j,v_k
are distinct -
v_j \to v_i \to v_k
-
v_j
is a source node (in-degree zero) -
v_k
is a sink node (out-degree zero)
Let P_{v_i}=\{p_1,p_2,\dots\}
denote the set of all paths defined as
above. Then the centrality of a node v_i
is given by
q(v_i)=\sum^{|P_{v_i}|}_{l=1}\#(p_l)
More plainly this is the number of paths containing v_i
of at least length 3 where v_i
is neither a source nor sink node.
Value
A dataframe containing the centrality of each node
Author(s)
Daniel Krasnov
References
Heileman, Gregory L, Chaouki T Abdallah, Ahmad Slim, and Michael Hickman. 2018. “Curricular Analytics: A Framework for Quantifying the Impact of Curricular Reforms and Pedagogical Innovations.” arXiv Preprint arXiv:1811.09676.
Examples
edge_list <- data.frame(from = c(1, 3), to = c(3, 4))
node_list <-
data.frame(
id = 1:4,
label = c("MATH 100", "DATA 101", "MATH 101", "MATH 221"),
term = c(1, 1, 2, 2)
)
cf_df <- centrality_factor(node_list,edge_list)
print(cf_df)
# Output:
# id cf
#1 1 0
#2 2 0
#3 3 3
#4 4 0