Run katz centrality function in a list of igraph objects

149 Views Asked by At

I'm trying to run katzcent function for a list of igraph interaction matrices, but a invalid alpha value error keeps appearing

# creating a list of random matrices and naming rows and columns

rmat <- lapply(1:162, function(x) matrix(rbinom(300, 1, 0.5),
                                        nrow=20, ncol=15))

coln <- lapply(rmat, function(x) {colnames(x) <- letters[1:15]; x})

mats <- lapply(coln, function(x) {rownames(x) <- letters[1:20]; x})

library(igraph)
library(centiserve)

# creating list of igraph objects from my incidence matrices

list_ig <- lapply(mats,igraph::graph_from_incidence_matrix)

kat <- lapply(list_ig, FUN=katzcent)

Error: Invalid alpha value keep appearing. I can use alpha = 0.1, that is the default for this function, so I don't need to modify that.

When running the katscent by single networks it work for some networks and for others give the same error

katzcent(list_ig[[1]])

Does anyone that is familiar with this function in centiserve package have a clue why this is hapenning?

0

There are 0 best solutions below