-
Notifications
You must be signed in to change notification settings - Fork 208
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
creation of nested subgraphs by vertex descriptors is broken/unintuitive #378
Comments
I'm a little nervous about changing behaviour in a way that might break existing code, although I agree that the current implementation does not sound ideal. Do you mind giving a more full example that demonstrates how unintuitive the current implementation is? |
The current approach breaks for all algorithms where a graph is recursively split into smaller subgraphs. My application is the decomposition of a cycle-free graph into a complete set of longest-possible traversal paths. (Complete here means that every vertex belongs to exactly one resulting traversal path). The approach is recursive and looks like this:
Both If you do not want to change behavior, the documentation should at least be updated (for all versions!) to reflect the behavior:
|
Let me get this straight in my head with some hierarchical labelling. I'll use A, B, C to denote graphs, a, b, c to denote vertices from their respective graphs. By definition of sequence, C is a subgraph of B, B is a subgraph of A, etc. When we call Intuitively, yes, it looks like that second call, B.create_subgraph(b), should just work without transforming local vertex descriptors to global ones, especially as the documentation for One thing that concerns me in your algorithm, which is somewhat related, is that it looks like Another thing, just a performance hint, but you're probably better of using |
I'd better take #161 into consideration when I look at this. |
Exactly: This is the (first) call that will yield wrong results. It can even modify B*.
I extract vertex properties ("
Thank you for the hint, I will look into these. * When adding vertices to the newly created subgraph by + Yes, |
When using
subgraph::create_subgraph(VertexIterator first, VertexIterator last)
, the vertex descriptors are interpreted as vertex descriptors into the root graph. (add_vertex
expects the given descriptor to be a root graph descriptor).My expectation is that the vertex descriptors should be interpreted as descriptors for the subgraph on which
create_subgraph
is called on. This way you can get a subgraph object, do some vertex selection logic on it and pass the set of selected vertices tocreate_subgraph
without ever needing to worry where the graph is situated in the subgraph tree.The fix is to replace line 197
add_vertex(*first, *m_children.back());
withadd_vertex(local_to_global(*first), *m_children.back());
.The text was updated successfully, but these errors were encountered: