Boost logo

Boost Users :

From: Matthias Linkenheil (M.Linkenheil_at_[hidden])
Date: 2004-12-22 05:35:51


Hello,

i have a problem with the filtered_graph example ( http://www.boost.org/libs/graph/doc/filtered_graph.html ).

I want to hide the edges with edge_capacity greather than zero like in the
filtered_graph example.
But this example doesn' t work in my algorithm because my graph is defined a little bit different and I don't know what I have to change!
(The edge_capacity is calculated with
edmunds_karp_max_flow)

Perhaps someone could help me.

Here is a part of my algorithm:

...
template <typename EdgeCapacityMap>
struct positive_edge_capacity {
  positive_edge_capacity() { }
  positive_edge_capacity(EdgeCapacityMap capacity) : m_capacity(capacity) { }
  template <typename Edge>
  bool operator()(const Edge& e) const {
    return 0 < boost::get(m_capacity, e);
  }
  EdgeCapacityMap m_capacity;
};
...

  typedef adjacency_list_traits<vecS, vecS, directedS> Traits;
  typedef property<vertex_index_t, int> VertexProperties;
  typedef property<edge_capacity_t, double,
          property<edge_residual_capacity_t, double,
          property<edge_reverse_t, Traits::edge_descriptor> > > EdgeProperties;
  typedef adjacency_list<vecS, vecS, directedS, VertexProperties, EdgeProperties > Graph;

  typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
  typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
  const int V = x_size*y_size;
  Graph g(V);
 
  property_map<Graph, vertex_index_t>::type vid = get(vertex_index, g);
  property_map<Graph, edge_capacity_t>::type cap = get(edge_capacity, g);
  property_map<Graph, edge_reverse_t>::type rev_edge = get(edge_reverse, g);
  property_map<Graph, edge_residual_capacity_t >::type res_cap = get(edge_residual_capacity, g);
...
 edmunds_karp_max_flow(g, s, t);
...
  positive_edge_capacity<cap> filter(get(edge_capacity, g));
  filtered_graph<Graph, positive_edge_capacity<cap> > fg(g, filter);
...


Thanks,
Matthias Linkenheil


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net