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.

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.

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.

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.