A bug on centrality_betweenness in R

Hi all,
Got a bug with centrality_betweenness with this piece of code

graph <- 
  graph %>%
  # calling the nodes
  activate(
    nodes
    ) %>%
  mutate(
    # calculating the centrality of degree
    degree = 
      centrality_degree()
    ) %>%
  mutate(
    # calculating centrality of betweeness for nodes
    betweenness = 
      centrality_betweenness(
        weights = length)
    ) %>%
  # calling the edges
  activate(
    edges
    ) %>%
  mutate(
    # calculating the betweeness for edges
    betweenness = 
      centrality_edge_betweenness(
        weights = length)
    )

got the message:

> Error in `mutate()`:
> ! Problem while computing `betweenness = centrality_betweenness(weights
>   = length)`.
> Caused by error in `betweenness()`:
> ! At core/core/vector.pmt:483 : Assertion failed: v->stor_begin != NULL. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it.
> Run `rlang::last_error()` to see where the error occurred.
> Warning message:
> Problem while computing `betweenness = centrality_betweenness(weights =
> length)`.
> i 'nobigint' is deprecated since igraph 1.3 and will be removed in igraph 1.4

Here is the link to the ‘edge’ and ‘nodes’
data

to replicate the graph, please use the code:

graph  <-  
  tbl_graph(
    nodes = nodes, 
    edges = as_tibble(edges),
    directed = FALSE
  )

graph <- 
  graph %>%
  activate(
    edges
    ) %>%
  mutate(
    length = 
      st_length(st_geometry(edges))
    )

You are using tidygraph, which is a separate package that is not supported on this forum.

For the sake of easing debugging, can you show a complete minimial example using plain igraph, and indicate your igraph version and platform, as well as where you obtained igraph from? Please try to minimize your data as well, and include only what is necessary.


Yes, this might be a bug in igraph’s C core, but I don’t use or know tidygraph, and rarely use R. It helps to have a clear example that is as independent from R as possible. Export the offending graph to a standard format if possible. The linked CSV files appear to be malformed, containing R-specific syntax (c(...)) which doesn’t appear to be readable even with R’s CSV importer.

Can you please provide the offending graph in a standard format such as GraphML?

If you can provide the data, this would be a good time to do it to have this fixes for the next version. As I said above, the CSVs you linked are corrupt, and can’t be read.