boostorg / boostorg/graph

connected_components called on empty filtered graph

Abierto
#231 2 comentarios 0 reacciones 0 asignados Ver en GitHub
algorithm beginner friendly priority: high
Lenguaje dominante
C++
Estrellas
392
Forks
239
Merge medio
1 d 11 min
PR fusionados (30 d)
20

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.