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

Incomplete graph in DAG check #28

Open
hellkite500 opened this issue Nov 30, 2023 · 1 comment
Open

Incomplete graph in DAG check #28

hellkite500 opened this issue Nov 30, 2023 · 1 comment

Comments

@hellkite500
Copy link

graph_from_data_frame(directed = TRUE) %>%

From the igraph documentation on graph_from_data_frame, I think the graph you make from this call will only get directed edges of wb-X -> nex-Y but I don't think you get the nex-X -> wb-Y edges. The dataframe columns need to have the toID -> ID mappings appended to the ID -> toID mappings to create the fully connected graph before the DAG check is performed.

@hellkite500
Copy link
Author

Testing my R skills (or lack thereof), if we add the nexus dataframe to this function, should be able to do something like this?

network_is_dag = function(fl, nex, ID = "id", toID = "toid"){
  edge1 <- st_drop_geometry(select(fl, !!ID, !!toID))
  edge2 <- st_drop_geometry(select(nex, !!ID, IItoID)
  
  rbind( edge1, edge2 ) %>%
    graph_from_data_frame(directed = TRUE) %>%
    is.dag()
}

What isn't clear is if network_list in the calling function has the nexus data available, or if that will require some refactoring to provide it to this function when called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant