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
How to transform directed graph to undirected graph? #291
Comments
Could you provide some details on what you mean by "viewing it as an undirected graph"? If you're speaking of an adapter for traversals & other algorithms, then no it isn't implemented. |
Yeah I meant an adaptor so I can pass my directed graph in to algorithms and have them treat it as an undirected graph. |
I'd definitely welcome that! Note that there's quite a few traits that you need to implement for most algorithms to work. I agree that copying |
FYI you can do this very simply right now with an unsafe transmute: https://timothy.hobbs.cz/rust-play/petgraph-internals.html#The-Graph-data-structure let undirected_tree : Graph<&str, &str, petgraph::Undirected> = unsafe {std::mem::transmute(tree.clone())}; |
I'm having a look at this now and I'm unsure whether I should implement |
PR for this here: #318 |
I have a directed graph and need to view it as an undirected graph. Is this implemented already or do I need to create my own adaptor?
The text was updated successfully, but these errors were encountered: