connected_components called on empty filtered graph
未关闭
algorithm
beginner friendly
priority: high
- 主要语言
- C++
- 星标
- 392
- 派生
- 239
- 平均合并
- 1 天 11 分钟
- 30 天内合并 PR
- 20
描述
The connected_components function returns `(std::numeric_limits::max)() + 1` when called on a filtered graph with all vertices filtered out.
An example of this problem can be found here:
https://godbolt.org/z/vWsG8j
If the line
```cpp
if (num_vertices(g) == 0) return 0;
```
was replaced with
```cpp
typedef typename boost::graph_traits::vertex_iterator vi;
std::pair verts = vertices(g);
if (verts.first == verts.second)
return 0;
```
the function would work as expected.
贡献指南
评估
这个 Issue 还没有评估数据。