예제 #1
0
    inline void
    dijkstra_dispatch2
      (const VertexListGraph& g,
       typename graph_traits<VertexListGraph>::vertex_descriptor s, 
       DistanceMap distance, WeightMap weight, IndexMap index_map,
       const Params& params)
    {
      // Default for predecessor map
      dummy_property_map p_map;

      typedef typename property_traits<DistanceMap>::value_type D;
      dijkstra_shortest_paths
        (g, s, 
         choose_param(get_param(params, vertex_predecessor), p_map),
         distance, weight, index_map, 
         choose_param(get_param(params, distance_compare_t()), 
                      std::less<D>()),
         choose_param(get_param(params, distance_combine_t()), 
                      closed_plus<D>()),
         choose_param(get_param(params, distance_inf_t()), 
                      std::numeric_limits<D>::max()),
         choose_param(get_param(params, distance_zero_t()), 
                      D()),
         choose_param(get_param(params, graph_visitor),
                      make_dijkstra_visitor(null_visitor())));
    }
    bool 
    bellman_dispatch2
      (VertexAndEdgeListGraph& g, 
       typename graph_traits<VertexAndEdgeListGraph>::vertex_descriptor s,
       Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance,
       const bgl_named_params<P, T, R>& params)
    {
      typedef typename property_traits<DistanceMap>::value_type D;
      bellman_visitor<> null_vis;
      typedef typename property_traits<WeightMap>::value_type weight_type;

      weight_type inf = 
          choose_param(get_param(params, distance_inf_t()), 
            std::numeric_limits<weight_type>::max BOOST_PREVENT_MACRO_SUBSTITUTION());

      typename graph_traits<VertexAndEdgeListGraph>::vertex_iterator v, v_end;
      for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
        put(distance, *v, inf);
        put(pred, *v, *v);
      }
      put(distance, s, weight_type(0));
      return bellman_ford_shortest_paths
               (g, N, weight, pred, distance,
                choose_param(get_param(params, distance_combine_t()),
                             closed_plus<D>()),
                choose_param(get_param(params, distance_compare_t()),
                             std::less<D>()),
                choose_param(get_param(params, graph_visitor),
                             null_vis)
                );
    }
예제 #3
0
 inline void
 astar_dispatch2
   (VertexListGraph& g,
    typename graph_traits<VertexListGraph>::vertex_descriptor s,
    AStarHeuristic h, CostMap cost, DistanceMap distance,
    WeightMap weight, IndexMap index_map, ColorMap color,
    const Params& params)
 {
   dummy_property_map p_map;
   typedef typename property_traits<CostMap>::value_type C;
   astar_search
     (g, s, h,
      choose_param(get_param(params, graph_visitor),
                   make_astar_visitor(null_visitor())),
      choose_param(get_param(params, vertex_predecessor), p_map),
      cost, distance, weight, index_map, color,
      choose_param(get_param(params, distance_compare_t()),
                   std::less<C>()),
      choose_param(get_param(params, distance_combine_t()),
                   closed_plus<C>()),
      choose_param(get_param(params, distance_inf_t()),
                   std::numeric_limits<C>::max BOOST_PREVENT_MACRO_SUBSTITUTION ()),
      choose_param(get_param(params, distance_zero_t()),
                   C()));
 }
예제 #4
0
 bool floyd_warshall_noninit_dispatch(const VertexAndEdgeListGraph& g, 
   DistanceMatrix& d, WeightMap w, 
   const bgl_named_params<P, T, R>& params)
 {
   typedef typename property_traits<WeightMap>::value_type WM;
 
   return floyd_warshall_all_pairs_shortest_paths(g, d, w,
     choose_param(get_param(params, distance_compare_t()), 
       std::less<WM>()),
     choose_param(get_param(params, distance_combine_t()), 
       closed_plus<WM>()),
     choose_param(get_param(params, distance_inf_t()), 
       std::numeric_limits<WM>::max BOOST_PREVENT_MACRO_SUBSTITUTION()),
     choose_param(get_param(params, distance_zero_t()), 
       WM()));
 }
    bool bellman_dispatch(EdgeListGraph& g, Size N, 
			  WeightMap weight, DistanceMap distance, 
			  const bgl_named_params<P, T, R>& params)
    {
      typedef typename property_traits<DistanceMap>::value_type D;
      bellman_visitor<> null_vis;
      dummy_property_map dummy_pred;
      return bellman_ford_impl
	(g, N, weight, 
	 choose_param(get_param(params, vertex_predecessor), dummy_pred),
	 distance,
	 choose_param(get_param(params, distance_combine_t()), std::plus<D>()),
	 choose_param(get_param(params, distance_compare_t()), std::less<D>()),
	 choose_param(get_param(params, graph_visitor), null_vis)
	 );
    }
 bool
 johnson_dispatch(VertexAndEdgeListGraph& g, 
                  DistanceMatrix& D,
                  const bgl_named_params<P, T, R>& params,
                  Weight w, VertexID id)
 {
   typedef typename property_traits<Weight>::value_type WT;
   
   return johnson_all_pairs_shortest_paths
     (g, D, id, w,
     choose_param(get_param(params, distance_compare_t()), 
       std::less<WT>()),
     choose_param(get_param(params, distance_combine_t()), 
       closed_plus<WT>()),
     choose_param(get_param(params, distance_inf_t()), 
       std::numeric_limits<WT>::max BOOST_PREVENT_MACRO_SUBSTITUTION()),
      choose_param(get_param(params, distance_zero_t()), WT()) );
 }
 bool 
 bellman_dispatch2
   (VertexAndEdgeListGraph& g, 
    detail::error_property_not_found,
    Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance,
    const bgl_named_params<P, T, R>& params)
 {
   typedef typename property_traits<DistanceMap>::value_type D;
   bellman_visitor<> null_vis;
   return bellman_ford_shortest_paths
            (g, N, weight, pred, distance,
             choose_param(get_param(params, distance_combine_t()),
                          closed_plus<D>()),
             choose_param(get_param(params, distance_compare_t()),
                          std::less<D>()),
             choose_param(get_param(params, graph_visitor),
                          null_vis)
             );
 }
예제 #8
0
 inline void
 dag_sp_dispatch2
   (const VertexListGraph& g,
    typename graph_traits<VertexListGraph>::vertex_descriptor s, 
    DistanceMap distance, WeightMap weight, ColorMap color, IndexMap /*id*/,
    DijkstraVisitor vis, const Params& params)
 {
   typedef typename property_traits<DistanceMap>::value_type D;
   dummy_property_map p_map;
   dag_shortest_paths
     (g, s, distance, weight, color, 
      choose_param(get_param(params, vertex_predecessor), p_map),
      vis, 
      choose_param(get_param(params, distance_compare_t()), std::less<D>()),
      choose_param(get_param(params, distance_combine_t()), closed_plus<D>()),
      choose_param(get_param(params, distance_inf_t()), 
                   (std::numeric_limits<D>::max)()),
      choose_param(get_param(params, distance_zero_t()), 
                   D()));
 }