Abort R session when calculating betweenness/closeness centrality

Hi, when I try to run the code to calculate betweenness centrality for a directed, weighted network (see below), my R session aborts with the error message “at 0x000000000 referenced memory at 0x00000000 the memory could not be written…” I think this is a glitch with igraph, not a code error, but not sure. Thank you for the help!

b1<-read.csv("AsMatrix_SP20.csv", header=TRUE, row.names=1)
netas <- graph.adjacency(mb1, mode="directed", weighted=TRUE, diag=FALSE)
inds<-igraph::betweenness(netas, directed = TRUE, normalized = FALSE)

Please show a complete reproducible example (including the offending data file).

If there are NA or NaN values in your data, be sure to get rid of them. igraph cannot usually handle them.

1 Like

I have attached the corresponding data file. Thank you for your help!

AsMatrix_SP20.csv (10.2 KB)

Your data indeed includes an NA as @szhorvat already indicated. Please remove the edge with the NA weight, or assign it an explicit weight, whatever would make most sense for your application.

1 Like

It may be a bit confusing if you look at the CSV with a text editor, as the “NA” is a literally a missing item. It is at position SEL, CLI.

1 Like

Perhaps in addition, igraph should never crash your R session, and we are fixing this bug, but it is not yet available in the igraph R package.

Thank you so much! Now I can understand the reason behind the “fatal error” for computing the weighted edge betweenness. After cleaning the weighted edge list, now I can run the function of “edge betweenness” without any error. This help means a lot! All the best!