luukvdmeer / sfnetworks

Tidy Geospatial Networks in R
https://luukvdmeer.github.io/sfnetworks/
Other
334 stars 20 forks source link

Converting igraph -> sfnetwork removes the linestring geometry from edges table #218

Closed agila5 closed 1 year ago

agila5 commented 2 years ago

Describe the bug Hi! I just found this relatively obscure bug that occurs when we convert an igraph object with spatially-explicit edges (i.e. an edge attribute that corresponds to a sfc) to sfnetwork format.

Reproducible example

# packages
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(tidygraph)
library(igraph)
library(sfnetworks)
options(sfn_max_print_active = 0L, sfn_max_print_inactive = 0L)

# From sf to sfnetwork (there is a geometry column in the edges table)
sfn <- as_sfnetwork(roxel)
sfn
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # Node Data:     701 x 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#> # ... with 701 more rows, and 1 variable: geometry <GEOMETRY [°]>
#> #
#> # Edge Data:     851 x 5
#> # Geometry type: LINESTRING
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#> # ... with 851 more rows, and 5 variables: from <int>, to <int>, name <chr>,
#> #   type <fct>, geometry <GEOMETRY [°]>

# From sfnetwork to igrpah (there is a geometry column in the edges table)
ig <- as.igraph(sfn)
ig
#> IGRAPH 9dc2d1e D--- 701 851 -- 
#> + attr: geometry (v/x), name (e/c), type (e/x), geometry (e/x)
#> + edges from 9dc2d1e:
#>  [1]   1->  2   3->  4   5->  6   7->  8   9-> 10  11-> 12  13-> 14   8-> 10
#>  [9]   7-> 15  16-> 17  18-> 19  20-> 21  22-> 23  24-> 25  26-> 27  28-> 29
#> [17]  30-> 31  32-> 33  34-> 35  36-> 37  38-> 39  40-> 41  42-> 43  44-> 45
#> [25]  46-> 45  47-> 48  49-> 50  51-> 52  53-> 54  55-> 56  57-> 58  59-> 60
#> [33]  61-> 62  63-> 64  65-> 66  67-> 68  69-> 70  71-> 72  73-> 74  75-> 76
#> [41]  77-> 78  79-> 80  81-> 82  72-> 83  74-> 84  76-> 85  86-> 87  88-> 89
#> [49]  90-> 91  92-> 93  94-> 95  96-> 97  98-> 99  68->100 101->102 103->104
#> [57] 105-> 41 106->107 108-> 62 109->110  45->111 112->113 114->115 116->117
#> + ... omitted several edges

# Back to sfnetwork (there is NO geometry column in the edges table)
as_sfnetwork(ig)
#> Checking if spatial network structure is valid...
#> Spatial network structure is valid
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially implicit edges
#> #
#> # Node Data:     701 x 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#> # ... with 701 more rows, and 1 variable: geometry <GEOMETRY [°]>
#> #
#> # Edge Data: 851 x 4
#> # ... with 851 more rows, and 4 variables: from <int>, to <int>, name <chr>,
#> #   type <fct>

Created on 2022-07-03 by the reprex package (v2.0.1)

Expected behavior I know that the problem can easily be solved by running as_sfnetwork(ig, edges_as_lines = TRUE) but I wouldn't expect to lose information going from sfnetwork to igraph and back to sfnetwork. Maybe we could readapt the code behind sfnetwork to take into account this possibility? Or at least add a warning message?

https://github.com/luukvdmeer/sfnetworks/blob/7a4db03e76b0237d9c33622977e51ea324ce28a2/R/sfnetwork.R#L129-L132

Maybe here add a check to see if any field in "edges" is an sfc?

R Session Info

Session info ``` r sessioninfo::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 4.1.3 (2022-03-10) #> os Windows 10 x64 (build 19044) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United Kingdom.1252 #> ctype English_United Kingdom.1252 #> tz Europe/Berlin #> date 2022-07-03 #> pandoc 2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown) #> #> - Packages ------------------------------------------------------------------- #> package * version date (UTC) lib source #> abind 1.4-5 2016-07-21 [1] CRAN (R 4.1.3) #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.3) #> class 7.3-20 2022-01-16 [2] CRAN (R 4.1.3) #> classInt 0.4-3 2020-04-07 [1] CRAN (R 4.1.3) #> cli 3.3.0 2022-04-25 [1] CRAN (R 4.1.3) #> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.1.3) #> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.1.3) #> DBI 1.1.2 2021-12-20 [1] CRAN (R 4.1.3) #> deldir 1.0-6 2021-10-23 [1] CRAN (R 4.1.3) #> digest 0.6.29 2021-12-01 [1] CRAN (R 4.1.3) #> dplyr 1.0.9 2022-04-28 [1] CRAN (R 4.1.3) #> e1071 1.7-9 2021-09-16 [1] CRAN (R 4.1.3) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.3) #> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.3) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.1.3) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.3) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.3) #> generics 0.1.2 2022-01-31 [1] CRAN (R 4.1.3) #> ggplot2 3.3.6 2022-05-03 [1] CRAN (R 4.1.3) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3) #> goftest 1.2-3 2021-10-07 [1] CRAN (R 4.1.3) #> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.1.3) #> highr 0.9 2021-04-16 [1] CRAN (R 4.1.3) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.3) #> igraph * 1.3.1 2022-04-20 [1] CRAN (R 4.1.3) #> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.1.3) #> knitr 1.39 2022-04-26 [1] CRAN (R 4.1.3) #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.1.3) #> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.3) #> lwgeom 0.2-8 2021-10-06 [1] CRAN (R 4.1.3) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.3) #> Matrix 1.4-0 2021-12-08 [2] CRAN (R 4.1.3) #> mgcv 1.8-39 2022-02-24 [2] CRAN (R 4.1.3) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.1.3) #> nlme 3.1-155 2022-01-16 [2] CRAN (R 4.1.3) #> pillar 1.7.0 2022-02-01 [1] CRAN (R 4.1.3) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.3) #> polyclip 1.10-0 2019-03-14 [1] CRAN (R 4.1.3) #> proxy 0.4-26 2021-06-07 [1] CRAN (R 4.1.3) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.3) #> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.3) #> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.1) #> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.1) #> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.3) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.3) #> Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.1.3) #> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.3) #> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.3) #> rmarkdown 2.14 2022-04-25 [1] CRAN (R 4.1.3) #> rpart 4.1.16 2022-01-24 [2] CRAN (R 4.1.3) #> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.3) #> s2 1.0.7 2021-09-28 [1] CRAN (R 4.1.3) #> scales 1.2.0 2022-04-13 [1] CRAN (R 4.1.3) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3) #> sf * 1.0-7 2022-03-07 [1] CRAN (R 4.1.3) #> sfheaders 0.4.0 2020-12-01 [1] CRAN (R 4.1.3) #> sfnetworks * 0.5.5.900 2022-06-26 [1] Github (luukvdmeer/sfnetworks@8641109) #> spatstat 2.3-4 2022-04-01 [1] CRAN (R 4.1.3) #> spatstat.core 2.4-4 2022-05-18 [1] CRAN (R 4.1.3) #> spatstat.data 2.2-0 2022-04-18 [1] CRAN (R 4.1.3) #> spatstat.geom 2.4-0 2022-03-29 [1] CRAN (R 4.1.3) #> spatstat.linnet 2.3-2 2022-02-16 [1] CRAN (R 4.1.3) #> spatstat.random 2.2-0 2022-03-30 [1] CRAN (R 4.1.3) #> spatstat.sparse 2.1-1 2022-04-18 [1] CRAN (R 4.1.3) #> spatstat.utils 2.3-1 2022-05-06 [1] CRAN (R 4.1.3) #> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.1.3) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.3) #> styler 1.7.0 2022-03-13 [1] CRAN (R 4.1.3) #> tensor 1.5 2012-05-05 [1] CRAN (R 4.1.3) #> tibble 3.1.7 2022-05-03 [1] CRAN (R 4.1.3) #> tidygraph * 1.2.1 2022-04-05 [1] CRAN (R 4.1.3) #> tidyr 1.2.0 2022-02-01 [1] CRAN (R 4.1.3) #> tidyselect 1.1.2 2022-02-21 [1] CRAN (R 4.1.3) #> units 0.8-0 2022-02-05 [1] CRAN (R 4.1.3) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.3) #> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.1.3) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.3) #> wk 0.6.0 2022-01-03 [1] CRAN (R 4.1.3) #> xfun 0.31 2022-05-10 [1] CRAN (R 4.1.3) #> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.1.3) #> #> [1] C:/Users/Andrea Gilardi/Documents/R/win-library/4.1 #> [2] C:/Program Files/R/R-4.1.3/library #> #> ------------------------------------------------------------------------------ ```
luukvdmeer commented 1 year ago

I cannot reproduce this in my environment. I am using development version of sfnetworks though, I will check if something changed in this regard.

library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.3, PROJ 8.2.0; sf_use_s2() is TRUE
library(tidygraph)
library(igraph)
library(sfnetworks)

sfn <- as_sfnetwork(roxel)
sfn
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # Node Data:     701 × 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>              geometry
#>           <POINT [°]>
#> 1 (7.533722 51.95556)
#> 2 (7.533461 51.95576)
#> 3 (7.532442 51.95422)
#> 4  (7.53209 51.95328)
#> 5 (7.532709 51.95209)
#> 6 (7.532869 51.95257)
#> # … with 695 more rows
#> #
#> # Edge Data:     851 × 5
#> # Geometry type: LINESTRING
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>    from    to name                  type                                geometry
#>   <int> <int> <chr>                 <fct>                       <LINESTRING [°]>
#> 1     1     2 Havixbecker Strasse   residential (7.533722 51.95556, 7.533461 51…
#> 2     3     4 Pienersallee          secondary   (7.532442 51.95422, 7.53236 51.…
#> 3     5     6 Schulte-Bernd-Strasse residential (7.532709 51.95209, 7.532823 51…
#> # … with 848 more rows

ig <- as.igraph(sfn)
ig
#> IGRAPH 797103f D--- 701 851 -- 
#> + attr: geometry (v/x), name (e/c), type (e/x), geometry (e/x)
#> + edges from 797103f:
#>  [1]   1->  2   3->  4   5->  6   7->  8   9-> 10  11-> 12  13-> 14   8-> 10
#>  [9]   7-> 15  16-> 17  18-> 19  20-> 21  22-> 23  24-> 25  26-> 27  28-> 29
#> [17]  30-> 31  32-> 33  34-> 35  36-> 37  38-> 39  40-> 41  42-> 43  44-> 45
#> [25]  46-> 45  47-> 48  49-> 50  51-> 52  53-> 54  55-> 56  57-> 58  59-> 60
#> [33]  61-> 62  63-> 64  65-> 66  67-> 68  69-> 70  71-> 72  73-> 74  75-> 76
#> [41]  77-> 78  79-> 80  81-> 82  72-> 83  74-> 84  76-> 85  86-> 87  88-> 89
#> [49]  90-> 91  92-> 93  94-> 95  96-> 97  98-> 99  68->100 101->102 103->104
#> [57] 105-> 41 106->107 108-> 62 109->110  45->111 112->113 114->115 116->117
#> + ... omitted several edges

as_sfnetwork(ig)
#> Checking if spatial network structure is valid...
#> Spatial network structure is valid
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # Node Data:     701 × 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>              geometry
#>           <POINT [°]>
#> 1 (7.533722 51.95556)
#> 2 (7.533461 51.95576)
#> 3 (7.532442 51.95422)
#> 4  (7.53209 51.95328)
#> 5 (7.532709 51.95209)
#> 6 (7.532869 51.95257)
#> # … with 695 more rows
#> #
#> # Edge Data:     851 × 5
#> # Geometry type: LINESTRING
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>    from    to name                  type                                geometry
#>   <int> <int> <chr>                 <fct>                       <LINESTRING [°]>
#> 1     1     2 Havixbecker Strasse   residential (7.533722 51.95556, 7.533461 51…
#> 2     3     4 Pienersallee          secondary   (7.532442 51.95422, 7.53236 51.…
#> 3     5     6 Schulte-Bernd-Strasse residential (7.532709 51.95209, 7.532823 51…
#> # … with 848 more rows

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.0 (2022-04-22)
#>  os       Ubuntu 20.04.4 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Etc/UTC
#>  date     2022-08-11
#>  pandoc   2.17.1.1 @ /usr/lib/rstudio-server/bin/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package         * version    date (UTC) lib source
#>  abind             1.4-5      2016-07-21 [1] RSPM (R 4.2.0)
#>  assertthat        0.2.1      2019-03-21 [1] RSPM (R 4.2.0)
#>  class             7.3-20     2022-01-16 [2] CRAN (R 4.2.0)
#>  classInt          0.4-7      2022-06-10 [1] RSPM (R 4.2.0)
#>  cli               3.2.0      2022-02-14 [1] RSPM (R 4.2.0)
#>  colorspace        2.0-3      2022-02-21 [1] RSPM (R 4.2.0)
#>  crayon            1.5.1      2022-03-26 [1] RSPM (R 4.2.0)
#>  DBI               1.1.3      2022-06-18 [1] RSPM (R 4.2.0)
#>  deldir            1.0-6      2021-10-23 [1] RSPM (R 4.2.0)
#>  digest            0.6.29     2021-12-01 [1] RSPM (R 4.2.0)
#>  dplyr             1.0.8      2022-02-08 [1] RSPM (R 4.2.0)
#>  e1071             1.7-11     2022-06-07 [1] RSPM (R 4.2.0)
#>  ellipsis          0.3.2      2021-04-29 [1] RSPM (R 4.2.0)
#>  evaluate          0.15       2022-02-18 [1] RSPM (R 4.2.0)
#>  fansi             1.0.3      2022-03-24 [1] RSPM (R 4.2.0)
#>  fastmap           1.1.0      2021-01-25 [1] RSPM (R 4.2.0)
#>  fs                1.5.2      2021-12-08 [1] RSPM (R 4.2.0)
#>  generics          0.1.2      2022-01-31 [1] RSPM (R 4.2.0)
#>  ggplot2           3.3.5      2021-06-25 [1] RSPM (R 4.2.0)
#>  glue              1.6.2      2022-02-24 [1] RSPM (R 4.2.0)
#>  goftest           1.2-3      2021-10-07 [1] RSPM (R 4.2.0)
#>  gtable            0.3.0      2019-03-25 [1] RSPM (R 4.2.0)
#>  highr             0.9        2021-04-16 [1] RSPM (R 4.2.0)
#>  htmltools         0.5.2      2021-08-25 [1] RSPM (R 4.2.0)
#>  igraph          * 1.3.2      2022-06-13 [1] RSPM (R 4.2.0)
#>  KernSmooth        2.23-20    2021-05-03 [2] CRAN (R 4.2.0)
#>  knitr             1.38       2022-03-25 [1] RSPM (R 4.2.0)
#>  lattice           0.20-45    2021-09-22 [2] CRAN (R 4.2.0)
#>  lifecycle         1.0.1      2021-09-24 [1] RSPM (R 4.2.0)
#>  lwgeom            0.2-9      2022-07-06 [1] Github (r-spatial/lwgeom@c0179b5)
#>  magrittr          2.0.3      2022-03-30 [1] RSPM (R 4.2.0)
#>  Matrix            1.4-1      2022-03-23 [2] CRAN (R 4.2.0)
#>  mgcv              1.8-40     2022-03-29 [2] CRAN (R 4.2.0)
#>  munsell           0.5.0      2018-06-12 [1] RSPM (R 4.2.0)
#>  nlme              3.1-157    2022-03-25 [2] CRAN (R 4.2.0)
#>  pillar            1.7.0      2022-02-01 [1] RSPM (R 4.2.0)
#>  pkgconfig         2.0.3      2019-09-22 [1] RSPM (R 4.2.0)
#>  polyclip          1.10-0     2019-03-14 [1] RSPM (R 4.2.0)
#>  proxy             0.4-27     2022-06-09 [1] RSPM (R 4.2.0)
#>  purrr             0.3.4      2020-04-17 [1] RSPM (R 4.2.0)
#>  R6                2.5.1      2021-08-19 [1] RSPM (R 4.2.0)
#>  Rcpp              1.0.8.3    2022-03-17 [1] RSPM (R 4.2.0)
#>  reprex            2.0.1      2021-08-05 [1] RSPM (R 4.2.0)
#>  rlang             1.0.2      2022-03-04 [1] RSPM (R 4.2.0)
#>  rmarkdown         2.13       2022-03-10 [1] RSPM (R 4.2.0)
#>  rpart             4.1.16     2022-01-24 [2] CRAN (R 4.2.0)
#>  rstudioapi        0.13       2020-11-12 [1] RSPM (R 4.2.0)
#>  s2                1.0.7.9000 2022-07-06 [1] Github (r-spatial/s2@ba104ce)
#>  scales            1.2.0      2022-04-13 [1] RSPM (R 4.2.0)
#>  sessioninfo       1.2.2      2021-12-06 [1] RSPM (R 4.2.0)
#>  sf              * 1.0-8      2022-07-06 [1] Github (r-spatial/sf@4014d22)
#>  sfheaders         0.4.0      2020-12-01 [1] RSPM (R 4.2.0)
#>  sfnetworks      * 0.5.5.900  2022-08-11 [1] local
#>  spatstat          2.3-4      2022-04-01 [1] RSPM (R 4.2.0)
#>  spatstat.core     2.4-4      2022-05-18 [1] RSPM (R 4.2.0)
#>  spatstat.data     2.2-0      2022-04-18 [1] RSPM (R 4.2.0)
#>  spatstat.geom     2.4-0      2022-03-29 [1] RSPM (R 4.2.0)
#>  spatstat.linnet   2.3-2      2022-02-16 [1] RSPM (R 4.2.0)
#>  spatstat.random   2.2-0      2022-03-30 [1] RSPM (R 4.2.0)
#>  spatstat.sparse   2.1-1      2022-04-18 [1] RSPM (R 4.2.0)
#>  spatstat.utils    2.3-1      2022-05-06 [1] RSPM (R 4.2.0)
#>  stringi           1.7.6      2021-11-29 [1] RSPM (R 4.2.0)
#>  stringr           1.4.0      2019-02-10 [1] RSPM (R 4.2.0)
#>  tensor            1.5        2012-05-05 [1] RSPM (R 4.2.0)
#>  tibble            3.1.6      2021-11-07 [1] RSPM (R 4.2.0)
#>  tidygraph       * 1.2.1      2022-04-05 [1] RSPM (R 4.2.0)
#>  tidyr             1.2.0      2022-02-01 [1] RSPM (R 4.2.0)
#>  tidyselect        1.1.2      2022-02-21 [1] RSPM (R 4.2.0)
#>  units             0.8-0      2022-02-05 [1] RSPM (R 4.2.0)
#>  utf8              1.2.2      2021-07-24 [1] RSPM (R 4.2.0)
#>  vctrs             0.4.1      2022-04-13 [1] RSPM (R 4.2.0)
#>  withr             2.5.0      2022-03-03 [1] RSPM (R 4.2.0)
#>  wk                0.6.0      2022-01-03 [1] RSPM (R 4.2.0)
#>  xfun              0.30       2022-03-02 [1] RSPM (R 4.2.0)
#>  yaml              2.3.5      2022-02-21 [1] RSPM (R 4.2.0)
#> 
#>  [1] /usr/local/lib/R/site-library
#>  [2] /usr/local/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Created on 2022-08-11 by the reprex package (v2.0.1)

agila5 commented 1 year ago

I cannot reproduce this in my environment. I am using development version of sfnetworks though, I will check if something changed in this regard.

Me neither, but I can reproduce the bug with the CRAN version of the package. I'll try to check which commit changed the behaviour 😅,

agila5 commented 1 year ago

I think the problem was fixed here when you added the if (edges_are_explicit) clause before running implicitize_edges() in sfnetwork.R 🎉