2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-29 19:42:11 +00:00

Graphs with zero vertices have zero connected components

[SVN r26403]
This commit is contained in:
Douglas Gregor
2004-12-02 16:32:05 +00:00
parent 604e5a7a45
commit 30ef8f84ff

View File

@@ -76,6 +76,8 @@ namespace boost {
connected_components(const Graph& g, ComponentMap c,
const bgl_named_params<P, T, R>& params)
{
if (num_vertices(g) == 0) return 0;
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
function_requires< WritablePropertyMapConcept<ComponentMap, Vertex> >();
typedef typename boost::graph_traits<Graph>::directed_category directed;
@@ -93,6 +95,8 @@ namespace boost {
inline typename property_traits<ComponentMap>::value_type
connected_components(const Graph& g, ComponentMap c)
{
if (num_vertices(g) == 0) return 0;
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
function_requires< WritablePropertyMapConcept<ComponentMap, Vertex> >();
typedef typename boost::graph_traits<Graph>::directed_category directed;