static typename edge_capacity_value<Graph, P, T, R>::type
 apply
 (Graph& g,
  typename graph_traits<Graph>::vertex_descriptor src,
  typename graph_traits<Graph>::vertex_descriptor sink,
  PredMap pred,
  const bgl_named_params<P, T, R>& params,
  detail::error_property_not_found)
 {
   typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
   typedef typename graph_traits<Graph>::vertices_size_type size_type;
   size_type n = is_default_param(get_param(params, vertex_color)) ?
     num_vertices(g) : 1;
   std::vector<default_color_type> color_vec(n);
   return edmunds_karp_max_flow
     (g, src, sink, 
      choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity),
      choose_pmap(get_param(params, edge_residual_capacity), 
                  g, edge_residual_capacity),
      choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse),
      make_iterator_property_map(color_vec.begin(), choose_const_pmap
                                 (get_param(params, vertex_index),
                                  g, vertex_index), color_vec[0]),
      pred);
 }
 inline OutputIterator
 kruskal_minimum_spanning_tree(const Graph& g,
                               OutputIterator spanning_tree_edges, 
                               const bgl_named_params<P, T, R>& params)
 {
   typedef typename graph_traits<Graph>::vertices_size_type size_type;
   typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
   if (num_vertices(g) == 0) return spanning_tree_edges; // Nothing to do in this case
   typename graph_traits<Graph>::vertices_size_type n;
   n = is_default_param(get_param(params, vertex_rank))
                                  ? num_vertices(g) : 1;
   std::vector<size_type> rank_map(n);
   n = is_default_param(get_param(params, vertex_predecessor))
                                  ? num_vertices(g) : 1;
   std::vector<vertex_t> pred_map(n);
   
   return detail::kruskal_mst_impl
     (g, spanning_tree_edges, 
      choose_param
      (get_param(params, vertex_rank), 
       make_iterator_property_map
       (rank_map.begin(), 
        choose_pmap(get_param(params, vertex_index), g, vertex_index), rank_map[0])),
      choose_param
      (get_param(params, vertex_predecessor), 
       make_iterator_property_map
       (pred_map.begin(), 
        choose_const_pmap(get_param(params, vertex_index), g, vertex_index), 
        pred_map[0])),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight));
 }
 bool
 johnson_all_pairs_shortest_paths
   (VertexAndEdgeListGraph& g, 
    DistanceMatrix& D,
    const bgl_named_params<P, T, R>& params)
 {
   return detail::johnson_dispatch
     (g, D, params,
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      choose_const_pmap(get_param(params, vertex_index), g, vertex_index)
      );
 }
Exemplo n.º 4
0
 inline void
 dijkstra_shortest_paths
   (const VertexListGraph& g,
    typename graph_traits<VertexListGraph>::vertex_descriptor s,
    const bgl_named_params<Param,Tag,Rest>& params)
 {
   // Default for edge weight and vertex index map is to ask for them
   // from the graph.  Default for the visitor is null_visitor.
   detail::dijkstra_dispatch1
     (g, s, 
      get_param(params, vertex_distance),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      choose_const_pmap(get_param(params, vertex_index), g, vertex_index),
      params);
 }
Exemplo n.º 5
0
  void
  astar_search
    (VertexListGraph &g,
     typename graph_traits<VertexListGraph>::vertex_descriptor s,
     AStarHeuristic h, const bgl_named_params<P, T, R>& params)
  {

    detail::astar_dispatch1
      (g, s, h,
       get_param(params, vertex_rank),
       get_param(params, vertex_distance),
       choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
       choose_const_pmap(get_param(params, vertex_index), g, vertex_index),
       get_param(params, vertex_color),
       params);

  }
Exemplo n.º 6
0
 bool floyd_warshall_all_pairs_shortest_paths(
   const VertexAndEdgeListGraph& g, DistanceMatrix& d, 
   const bgl_named_params<P, T, R>& params)
 {
   return detail::floyd_warshall_noninit_dispatch(g, d, 
     choose_const_pmap(get_param(params, edge_weight), g, edge_weight), 
     params);
 }
 static typename edge_capacity_value<Graph, P, T, R>::type
 apply
 (Graph& g,
  typename graph_traits<Graph>::vertex_descriptor src,
  typename graph_traits<Graph>::vertex_descriptor sink,
  PredMap pred,
  const bgl_named_params<P, T, R>& params,
  ColorMap color)
 {
   return edmunds_karp_max_flow
     (g, src, sink, 
      choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity),
      choose_pmap(get_param(params, edge_residual_capacity), 
                  g, edge_residual_capacity),
      choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse),
      color, pred);
 }
Exemplo n.º 8
0
 inline void
 dag_shortest_paths
   (const VertexListGraph& g,
    typename graph_traits<VertexListGraph>::vertex_descriptor s,
    const bgl_named_params<Param,Tag,Rest>& params)
 {
   // assert that the graph is directed...
   null_visitor null_vis;
   detail::dag_sp_dispatch1
     (g, s, 
      get_param(params, vertex_distance),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      get_param(params, vertex_color),
      choose_const_pmap(get_param(params, vertex_index), g, vertex_index),
      choose_param(get_param(params, graph_visitor),
                   make_dijkstra_visitor(null_vis)),
      params);
 }
 bool bellman_ford_shortest_paths
   (EdgeListGraph& g, Size N, 
    const bgl_named_params<P, T, R>& params)
 {                                
   return detail::bellman_dispatch
     (g, N,
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      choose_pmap(get_param(params, vertex_distance), g, vertex_distance),
      params);
 }
Exemplo n.º 10
0
 inline void prim_minimum_spanning_tree
   (const VertexListGraph& g,
    PredecessorMap p_map,
    const bgl_named_params<P,T,R>& params)
 {
   detail::prim_mst_impl
     (g, 
      choose_param(get_param(params, root_vertex_t()), *vertices(g).first), 
      params.predecessor_map(p_map),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight));
 }
 bool bellman_ford_shortest_paths
   (VertexAndEdgeListGraph& g, 
    const bgl_named_params<P, T, R>& params)
 {               
   function_requires<VertexListGraphConcept<VertexAndEdgeListGraph> >();
   return detail::bellman_dispatch
     (g, num_vertices(g),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      choose_pmap(get_param(params, vertex_distance), g, vertex_distance),
      params);
 }
Exemplo n.º 12
0
 bool bellman_ford_shortest_paths
   (VertexAndEdgeListGraph& g, 
    const bgl_named_params<P, T, R>& params)
 {               
   BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<VertexAndEdgeListGraph> ));
   return detail::bellman_dispatch
     (g, num_vertices(g),
      choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
      choose_pmap(get_param(params, vertex_distance), g, vertex_distance),
      params);
 }
Exemplo n.º 13
0
 static void
 apply(const Graph& g, DFSVisitor vis, Vertex start_vertex,
       const bgl_named_params<P, T, R>& params,
       EdgeColorMap edge_color,
       param_not_found)
 {
   std::vector<default_color_type> color_vec(num_vertices(g));
   default_color_type c = white_color; // avoid warning about un-init
   undirected_dfs
     (g, vis, make_iterator_property_map
      (color_vec.begin(),
       choose_const_pmap(get_param(params, vertex_index),
                         g, vertex_index), c),
      edge_color,
      start_vertex);
 }
Exemplo n.º 14
0
 inline static typename property_traits<ComponentMap>::value_type
 apply(const Graph& g,
       ComponentMap comp,
       RootMap r_map,
       const bgl_named_params<P, T, R>& params,
       param_not_found)
 {
     typedef typename graph_traits<Graph>::vertices_size_type size_type;
     size_type       n = num_vertices(g) > 0 ? num_vertices(g) : 1;
     std::vector<size_type> time_vec(n);
     return strong_components_impl
            (g, comp, r_map,
             make_iterator_property_map(time_vec.begin(), choose_const_pmap
                                        (get_param(params, vertex_index),
                                         g, vertex_index), time_vec[0]),
             params);
 }
Exemplo n.º 15
0
 inline static typename property_traits<ComponentMap>::value_type
 apply(const Graph& g,
       ComponentMap comp,
       const bgl_named_params<P, T, R>& params,
       param_not_found)
 {
     typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
     typename std::vector<Vertex>::size_type
     n = num_vertices(g) > 0 ? num_vertices(g) : 1;
     std::vector<Vertex> root_vec(n);
     return scc_helper2
            (g, comp,
             make_iterator_property_map(root_vec.begin(), choose_const_pmap
                                        (get_param(params, vertex_index),
                                         g, vertex_index), root_vec[0]),
             params,
             get_param(params, vertex_discover_time));
 }
Exemplo n.º 16
0
 static void apply
 (VertexListGraph& g,
  typename graph_traits<VertexListGraph>::vertex_descriptor s,
  const bgl_named_params<P, T, R>& params,
  detail::error_property_not_found)
 {
   std::vector<default_color_type> color_vec(num_vertices(g));
   default_color_type c = white_color;
   null_visitor null_vis;
   
   bfs_helper
     (g, s, 
      make_iterator_property_map
      (color_vec.begin(), 
       choose_const_pmap(get_param(params, vertex_index), 
                         g, vertex_index), c),
      choose_param(get_param(params, graph_visitor),
                   make_bfs_visitor(null_vis)),
      params);
 }
 static typename edge_capacity_value<Graph, P, T, R>::type
 apply
 (Graph& g,
  typename graph_traits<Graph>::vertex_descriptor src,
  typename graph_traits<Graph>::vertex_descriptor sink,
  const bgl_named_params<P, T, R>& params,
  detail::error_property_not_found)
 {
   typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
   typedef typename graph_traits<Graph>::vertices_size_type size_type;
   size_type n = is_default_param(get_param(params, vertex_predecessor)) ?
     num_vertices(g) : 1;
   std::vector<edge_descriptor> pred_vec(n);
   
   typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C;
   return edmunds_karp_dispatch2<C>::apply
     (g, src, sink, 
      make_iterator_property_map(pred_vec.begin(), choose_const_pmap
                                 (get_param(params, vertex_index),
                                  g, vertex_index), pred_vec[0]),
      params, 
      get_param(params, vertex_color));
 }
Exemplo n.º 18
0
      static void apply
      (VertexListGraph& g,
       typename graph_traits<VertexListGraph>::vertex_descriptor s,
       EdgeType e,
       const bgl_named_params<P, T, R>& params,
       param_not_found)
      {
        null_visitor null_vis;

        bfs_helper
          (g, s, e,
           make_two_bit_color_map
           (num_vertices(g),
            choose_const_pmap(get_param(params, vertex_index),
                              g, vertex_index)),
           choose_param(get_param(params, graph_visitor),
                        make_bfs_visitor(null_vis)),
           params,
           boost::mpl::bool_<
           boost::is_base_and_derived<
           distributed_graph_tag,
           typename graph_traits<VertexListGraph>::traversal_category>::value>());
      }