Skip to content

igraph_to_dodgr isn't compatible with other functions #332

@MarkPaulin

Description

@MarkPaulin

I'm using igraph_to_dodgr() to prepare a network for using with dodgr. I noticed some of the column names don't look quite right and the output wasn't compatible with dodgr_distances() or other functions. I've tried to create a reprex below, I think the columns like x_from should be named from_x, possibly from tweaking this line and the same for the "to" columns.

I can submit a PR if you'd like.

library(dodgr)
#> Warning: package 'dodgr' was built under R version 4.5.3

graph <- weight_streetnet(hampi)

graph2 <- graph |> 
  dodgr_to_igraph() |> 
  igraph_to_dodgr()
#> Loading required namespace: igraph

names(graph2)
#>  [1] "edge_id"       "from_id"       "to_id"         "weight"       
#>  [5] "d_weighted"    "time"          "time_weighted" "component"    
#>  [9] "x_from"        "y_from"        "n_from"        "x_to"         
#> [13] "y_to"          "n_to"

dodgr_distances(graph, from = "2398957768", to = "1390214848")
#>            1390214848
#> 2398957768   524.0256
dodgr_distances(graph2, from = "2398957768", to = "1390214848")
#> Error in `find_d_col()`:
#> ! Unable to determine distance column in graph

Created on 2026-03-31 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions