dijkstra_shortest_paths.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. namespace boost { namespace graph { namespace distributed { namespace detail {
  14. /**********************************************************************
  15. * Dijkstra queue message data *
  16. **********************************************************************/
  17. template<typename DistanceMap, typename PredecessorMap>
  18. class dijkstra_msg_value
  19. {
  20. typedef typename property_traits<DistanceMap>::value_type distance_type;
  21. typedef typename property_traits<PredecessorMap>::value_type
  22. predecessor_type;
  23. public:
  24. typedef std::pair<distance_type, predecessor_type> type;
  25. static type create(distance_type dist, predecessor_type pred)
  26. { return std::make_pair(dist, pred); }
  27. };
  28. template<typename DistanceMap>
  29. class dijkstra_msg_value<DistanceMap, dummy_property_map>
  30. {
  31. typedef typename property_traits<DistanceMap>::key_type vertex_descriptor;
  32. public:
  33. typedef typename property_traits<DistanceMap>::value_type type;
  34. static type create(type dist, vertex_descriptor) { return dist; }
  35. };
  36. /**********************************************************************/
  37. } } } } // end namespace boost::graph::distributed::detail
  38. #endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP