I am trying to calculate robustness, a graph theory measure using R (braingraph package).

Robustness = robustness(my_networkgraph, type = c("vertex"),  measure = ("btwn.cent"))

I get the following error, when I use the above robustness function:

Error in order(vertex_attr(g, measure), decreasing = TRUE) : argument 1 is not a vector

Any idea, what I am doing wrong here?

My network, which is a matrix has been converted to igraph object and robustness was calculated.

My network as a matrix:

mynetwork <- matrix(c(0, 1, 0, 1, 0, 0, 0, 0, 
              1, 0, 1, 0, 0, 0, 0, 0, 
              0, 1, 0, 0, 0, 0, 0, 0, 
              1, 0, 0, 0, 0, 1, 0, 0, 
              0, 0, 0, 0, 0, 1, 0, 0, 
              0, 0, 0, 1, 1, 0, 1, 1, 
              0, 0, 0, 0, 0, 1, 0, 0, 
              0, 0, 0, 0, 0, 1, 0, 0), nrow = 8)

This matrix was converted as igraph using the following code:

my_networkgraph <-graph_from_adjacency_matrix(mynetwork, mode = c("undirected"),weighted = NULL, diag = TRUE,   add.colnames = NULL, add.rownames = NA)

Please help me to understand the above error

Thanks

Priya

1

There are 1 answers

0
Priya On

There was a bug in the above function. To run the robustness code, you will need to supply a vertex attribute to your network: V(network)$degree <- degree(network) V(network)$btwn.cent <- centr_betw(network)$res