Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load graph using read.graph.ncol #1346

Closed
knwng opened this issue Apr 20, 2024 · 4 comments · Fixed by #1347
Closed

Failed to load graph using read.graph.ncol #1346

knwng opened this issue Apr 20, 2024 · 4 comments · Fixed by #1347
Labels
bug an unexpected problem or unintended behavior

Comments

@knwng
Copy link
Contributor

knwng commented Apr 20, 2024

What happens, and what did you expect instead?

Trackback:

Error in read.graph.ncol(file, ...): INTEGER() can only be applied to a 'integer', not a 'double'
Traceback:

1. read_graph(paste(file_path, edge_files[i], sep = ""), format = "ncol", 
 .     directed = TRUE)
2. read.graph.ncol(file, ...)

To reproduce

shell_call <- function(command, ...) {
  result <- system(command, intern = TRUE, ...)
  cat(paste0(result, collapse = "\n"))
}

shell_call("if [[ ! -e gplus.tar.gz ]]; then wget https://snap.stanford.edu/data/gplus.tar.gz; fi")
shell_call("if [[ ! -e gplus.tar.gz ]]; then tar zxf gplus.tar.gz; fi")

remove.packages("igraph")
# install.packages("igraph", version = "1.5.1")
install.packages("devtools")
require(devtools)
install_packages("igraph", version = "1.5.1", repos=c(
    igraph = 'https://igraph.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'
  ))

library ("igraph")

graph = read_graph("gplus/100535338638690515335.edges", format="ncol", directed=TRUE)

System information

It's on a google colab runtime.

Output of sessionInfo():

R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] igraph_2.0.3

loaded via a namespace (and not attached):
 [1] digest_0.6.29   IRdisplay_1.1   utf8_1.2.2      base64enc_0.1-3
 [5] fastmap_1.1.0   magrittr_2.0.2  glue_1.6.1      pkgconfig_2.0.3
 [9] htmltools_0.5.2 repr_1.1.7      lifecycle_1.0.1 cli_3.2.0      
[13] fansi_1.0.2     vctrs_0.3.8     pbdZMQ_0.3-11   compiler_4.3.3 
[17] tools_4.3.3     evaluate_0.15   pillar_1.7.0    ellipsis_0.3.2 
[21] rlang_1.0.1     jsonlite_1.7.3  crayon_1.5.0    IRkernel_1.3.2 
[25] uuid_1.0-3   
@knwng
Copy link
Contributor Author

knwng commented Apr 20, 2024

Seems it's related to this commit: c92a172

It works when downgrade to 1.5.1

@szhorvat
Copy link
Member

Reasonable size repro:

library(igraph)
g<-make_graph(c(1,2,2,3))
write_graph(g, 'zoo.ncol', 'ncol')
read_graph('zoo.ncol', 'ncol')

@szhorvat
Copy link
Member

Thanks for reporting this and tracking down the offending commit! A PR with a fix is opened now.

@krlmlr krlmlr added the bug an unexpected problem or unintended behavior label Apr 23, 2024
@maelle
Copy link
Contributor

maelle commented May 23, 2024

I removed the label from the issue since it's also on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants