connected_components called on empty filtered graph
オープン
algorithm
beginner friendly
priority: high
- 主要言語
- C++
- スター
- 392
- フォーク
- 239
- 平均マージ
- 1日 11分
- マージ済み PR(30日)
- 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 はまだ評価されていません。