31 #ifndef INCLUDE_COLORING_PGR_BIPARTITE_DRIVER_HPP_
32 #define INCLUDE_COLORING_PGR_BIPARTITE_DRIVER_HPP_
35 #include <boost/property_map/property_map.hpp>
36 #include <boost/property_map/vector_property_map.hpp>
37 #include <boost/type_traits.hpp>
38 #include <boost/graph/bipartite.hpp>
55 typedef typename G::V_i
V_i;
58 std::vector<pgr_bipartite_rt> results;
59 std::vector <boost::default_color_type> partition(graph.num_vertices());
61 make_iterator_property_map(partition.begin(), boost::get(boost::vertex_index, graph.graph));
64 CHECK_FOR_INTERRUPTS();
66 boost::is_bipartite(graph.graph, boost::get(boost::vertex_index, graph.graph), partition_map);
67 }
catch (boost::exception
const& ex) {
70 }
catch (std::exception &e) {
77 for (boost::tie(v, vend) = vertices(graph.graph); v != vend; ++v) {
78 int64_t vid = graph[*v].id;
79 boost::get(partition_map, *v) ==
80 boost::color_traits <boost::default_color_type>::white() ?
81 results.push_back({vid, 0}) :results.push_back({vid, 1});
87 std::vector<pgr_bipartite_rt> results;
88 bool bipartite = boost::is_bipartite(graph.graph);
89 if (bipartite) results = print_Bipartite(graph);
95 #endif // INCLUDE_COLORING_PGR_BIPARTITE_DRIVER_HPP_