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

Invalid (non-finite or NaN) vertex #164

Open
nick-youngblut opened this issue Oct 12, 2022 · 1 comment
Open

Invalid (non-finite or NaN) vertex #164

nick-youngblut opened this issue Oct 12, 2022 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@nick-youngblut
Copy link

Reprex of error:

Use the email_nodes.csv and email_edges.csv tables from https://michaelgastner.com/DAVisR2021/chap-tidygraph.html.
If running the code shown in the ebook:

email_directed_netw <-
  tbl_graph(nodes = email_nodes, edges = email_edges)

...then the command run successfully.

However, if one uses:

email_directed_netw <-
  tbl_graph(nodes = head(email_nodes), edges = head(email_edges))

...then the error is:

Error in (function (edges, n = max(edges), directed = TRUE)  : 
  At core/constructors/basic_constructors.c:72 : Invalid (non-finite or NaN) vertex index when creating graph. Invalid value

If using head() results in an incomplete network, and that is the issue, then a better error message pointing to the problem would be very helpful.

sessionInfo

R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] networkD3_0.4     tidygraph_1.2.2   tidytable_0.9.0   data.table_1.14.2
[5] RPostgres_1.4.4   DBI_1.1.3        

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9        pillar_1.8.1      compiler_4.2.1    tools_4.2.1      
 [5] digest_0.6.29     bit_4.0.4         lubridate_1.8.0   jsonlite_1.8.2   
 [9] lifecycle_1.0.3   tibble_3.1.8      pkgconfig_2.0.3   rlang_1.0.6      
[13] igraph_1.3.5      cli_3.4.1         yaml_2.3.5        fastmap_1.1.0    
[17] withr_2.5.0       dplyr_1.0.10      generics_0.1.3    vctrs_0.4.2      
[21] htmlwidgets_1.5.4 hms_1.1.2         bit64_4.0.5       tidyselect_1.2.0 
[25] glue_1.6.2        R6_2.5.1          fansi_1.0.3       tidyr_1.2.1      
[29] purrr_0.3.5       blob_1.2.3        magrittr_2.0.3    ellipsis_0.3.2   
[33] htmltools_0.5.3   renv_0.15.5       utf8_1.2.2 
@thomasp85
Copy link
Owner

I know this is late I'm coming to this issue. The link above no longer works. If you are interested can you reproduce the issue with available data?

I'm quite sure the issue is that you are creating an invalid graph representation by just taking the top rows of the two tables but I agree a better error would be beneficial

@thomasp85 thomasp85 added the bug an unexpected problem or unintended behavior label Nov 2, 2023
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

No branches or pull requests

2 participants