filtered_graph.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2004-2008 The Trustees of Indiana University.
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Authors: Nick Edmonds
  6. // Douglas Gregor
  7. // Andrew Lumsdaine
  8. #ifndef BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP
  9. #define BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP
  10. #ifndef BOOST_GRAPH_USE_MPI
  11. #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
  12. #endif
  13. #include <boost/graph/parallel/process_group.hpp>
  14. #include <boost/graph/filtered_graph.hpp>
  15. namespace boost {
  16. namespace graph {
  17. namespace parallel {
  18. /// Retrieve the process group from a filtered graph
  19. template<typename Graph, typename EdgePredicate, typename VertexPredicate>
  20. struct process_group_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> >
  21. : process_group_type<Graph> { };
  22. template<typename Graph, typename EdgePredicate, typename VertexPredicate>
  23. struct process_group_type<const filtered_graph<Graph, EdgePredicate, VertexPredicate> >
  24. : process_group_type<Graph> { };
  25. }
  26. }
  27. /// Retrieve the process group from a filtered graph
  28. template<typename Graph, typename EdgePredicate, typename VertexPredicate>
  29. inline typename graph::parallel::process_group_type<Graph>::type
  30. process_group(filtered_graph<Graph, EdgePredicate, VertexPredicate> const& g) {
  31. return process_group(g.m_g);
  32. }
  33. /// Forward vertex() to vertex() of the base graph
  34. template <typename Graph, typename EdgePredicate, typename VertexPredicate>
  35. typename graph_traits<Graph>::vertex_descriptor
  36. vertex(typename graph_traits<Graph>::vertices_size_type i,
  37. filtered_graph<Graph, EdgePredicate, VertexPredicate> const& g)
  38. { return vertex(i, g.m_g); }
  39. }
  40. #endif // BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP