boostorg / boostorg/graph

creation of nested subgraphs by vertex descriptors is broken/unintuitive

Open
#378 17 comments 0 reactions 1 assignee Claimed by @jeremy-murphy View on GitHub
data structure priority: medium
Dominant language
C++
Stars
392
Forks
239
Avg merge
1d 11m
Merged PRs (30d)
20

Description

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 to `create_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());` with `add_vertex(local_to_global(*first), *m_children.back());`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.