boostorg / boostorg/graph

connected_components called on empty filtered graph

オープン
#231 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。