dijkstra_shortest_paths.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2004-2006 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: Douglas Gregor
  6. // Andrew Lumsdaine
  7. #ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP
  8. #define BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP
  9. #ifndef BOOST_GRAPH_USE_MPI
  10. #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
  11. #endif
  12. #include <boost/property_map/property_map.hpp>
  13. #include <boost/property_map/parallel/parallel_property_maps.hpp>
  14. namespace boost { namespace graph { namespace distributed { namespace detail {
  15. /**********************************************************************
  16. * Dijkstra queue message data *
  17. **********************************************************************/
  18. template<typename DistanceMap, typename PredecessorMap>
  19. class dijkstra_msg_value
  20. {
  21. typedef typename property_traits<DistanceMap>::value_type distance_type;
  22. typedef typename property_traits<PredecessorMap>::value_type
  23. predecessor_type;
  24. public:
  25. typedef std::pair<distance_type, predecessor_type> type;
  26. static type create(distance_type dist, predecessor_type pred)
  27. { return std::make_pair(dist, pred); }
  28. };
  29. template<typename DistanceMap>
  30. class dijkstra_msg_value<DistanceMap, dummy_property_map>
  31. {
  32. typedef typename property_traits<DistanceMap>::key_type vertex_descriptor;
  33. public:
  34. typedef typename property_traits<DistanceMap>::value_type type;
  35. static type create(type dist, vertex_descriptor) { return dist; }
  36. };
  37. /**********************************************************************/
  38. } } } } // end namespace boost::graph::distributed::detail
  39. #endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP