DOI-USGS / hydroloom

hydrologic geospatial fabric creation tools. See official repository here: https://code.usgs.gov/water/hydroloom
https://doi-usgs.github.io/hydroloom/
Creative Commons Zero v1.0 Universal
25 stars 2 forks source link

check_graph should be able to return a list of loops. #7

Closed dblodgett-usgs closed 1 year ago

dblodgett-usgs commented 1 year ago

Currently not exported, it would be cool to export check_graph() and allow it to return the issue ids.

# LOOPS!!! 
flow_table <- flow_table |>
  filter(id %in% fl$id) |>
  mutate(toid = ifelse(!toid %in% id, "", toid)) |>
  mutate(r = 1:n())

remove <- left_join(flow_table, flow_table, 
               by = c("toid" = "id")) |>
  filter(id == toid.y) |>
  pull(r.x)

flow_table <- filter(flow_table, !r %in% remove) |>
  select(-r)