// Copyright 2005 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine #include #include "graph.hpp" #include "digraph.hpp" #include namespace boost { namespace graph { namespace python { template int connected_components (Graph& g, const vector_property_map* in_component, const vector_property_map* in_color) { typedef vector_property_map ComponentMap; typedef vector_property_map ColorMap; ComponentMap component = in_component? *in_component : g.template get_vertex_map("component"); ColorMap color = in_color? *in_color : ColorMap(g.num_vertices(), g.get_vertex_index_map()); return boost::connected_components(g, component, color_map(color)); } void export_connected_components() { using boost::python::arg; using boost::python::def; def("connected_components", &connected_components, (arg("graph"), arg("component_map") = (vector_property_map*)0, arg("color_map") = (vector_property_map*)0)); } } } } // end namespace boost::graph::python