Exemplo n.º 1
0
     std::vector<std::vector<double> > johnson_shortest_paths() {
         v_index N = num_verts();

         std::vector<std::vector<double> > D(N, std::vector<double>(N));
         if (johnson_all_pairs_shortest_paths(*graph, D)) {
             return D;
         } else {
             return std::vector<std::vector<double> >();
         }
     }
 bool
 johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1, 
              DistanceMatrix& D,
              VertexID id1, Weight w1, DistanceZero zero)
 {
   typedef typename property_traits<Weight>::value_type WT;
   return johnson_all_pairs_shortest_paths(g1, D, id1, w1, 
                                           std::less<WT>(),
                                           closed_plus<WT>(),
                                           (std::numeric_limits<WT>::max)(),
                                           zero);
 }
 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()) );
 }