tests/test-degree.R

library(CommKern)

# Does the trace of the degree matrix match column and row sums?
vertex_df_ex <- data.frame(node_id=seq(1:80),node_label=NA,
                           func_degree=NA,str_degree=NA,community=NA)

func_mat_ex <- SBM_net$func_matrix
str_mat_ex <- SBM_net$str_matrix

vertex_df_ex <- CommKern:::degree(func_mat_ex,str_mat_ex,vertex_df_ex)

stopifnot(all(vertex_df_ex$func_degree==colSums(func_mat_ex)))
stopifnot(all(vertex_df_ex$func_degree==rowSums(func_mat_ex)))
stopifnot(all(vertex_df_ex$str_degree==colSums(str_mat_ex)))
stopifnot(all(vertex_df_ex$str_degree==colSums(str_mat_ex)))

Try the CommKern package in your browser

Any scripts or data that you put into this service are public.

CommKern documentation built on Sept. 23, 2022, 5:07 p.m.