- reachability <- function(g, m) {
- reach_mat = matrix(nrow = vcount(g),
- ncol = vcount(g))
- for (i in 1:vcount(g)) {
- reach_mat[i,] = 0
- this_node_reach <- subcomponent(g, (i - 1), mode = m)
-
- for (j in 1:(length(this_node_reach))) {
- alter = this_node_reach[j] + 1
- reach_mat[i, alter] = 1
- }
- }
- return(reach_mat)
- }
- reach_full_in <- reachability(krack_full, 'in')
出现这种错误,怎么办?