// 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 #include #include namespace boost { namespace graph { namespace python { template boost::python::list biconnected_components (Graph& g, const vector_property_map* in_component) { typedef vector_property_map ComponentMap; ComponentMap component = in_component? *in_component : g.template get_edge_map("bicomponent"); std::list art_points; boost::biconnected_components(g, component, std::back_inserter(art_points), boost::vertex_index_map(g.get_vertex_index_map())); boost::python::list result; for (typename std::list::iterator i = art_points.begin(); i != art_points.end(); ++i) result.append(*i); return result; } template boost::python::list articulation_points(const Graph& g) { std::list art_points; boost::python::list result; boost::articulation_points(g, std::back_inserter(art_points), boost::vertex_index_map(g.get_vertex_index_map())); for (typename std::list::iterator i = art_points.begin(); i != art_points.end(); ++i) result.append(*i); return result; } void export_biconnected_components() { using boost::python::arg; using boost::python::def; def("biconnected_components", &biconnected_components, (arg("graph"), arg("component_map") = (vector_property_map*)0)); def("articulation_points", &articulation_points, (arg("graph"))); def("biconnected_components", &biconnected_components, (arg("graph"), arg("component_map") = (vector_property_map*)0)); def("articulation_points", &articulation_points, (arg("graph"))); } } } } // end namespace boost::graph::python