Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] newbie to graph (Andrew Sutton)
From: Lior Weizman (lior.weizman_at_[hidden])
Date: 2008-11-02 06:32:11


Thank you for your reply.

I implemented your suggestions but the problem persists. Below is the
current version of my code:
#include <boost/config.hpp>
#include <iostream>
#include <string>
#include <boost/graph/kolmogorov_max_flow.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/write_dimacs.hpp>
#include <boost/graph/read_dimacs.hpp>
using namespace boost;
struct Arc;
struct Node;
typedef adjacency_list<vecS,vecS,directedS,Node,Arc> Graph;
struct Arc {
    long capacity;
    long residual_capacity;
    Graph::edge_descriptor reverse;
struct Node {
    std::string name;
    typedef Graph::vertex_descriptor vertex_descriptor;
    typedef Graph::edge_descriptor edge_descriptor;
    typedef std::pair<edge_descriptor, bool> EdgePair;
    typedef std::pair<int,int> Pair;
    Graph g;
    property_map<Graph, long Arc::*>::type capacity
        = get(&Arc::capacity, g);
    property_map<Graph, Graph::edge_descriptor Arc::*>::type rev
        = get(&Arc::reverse,g);
    long flow;
    vertex_descriptor s, t;
    Pair edge_array[6] = { Pair(0,1), Pair(0,2), Pair(0,3),
                           Pair(1,3), Pair(4,3),
    EdgePair edge_desc_obj;
    for (int i = 1; i < 5; ++i){
        edge_desc_obj=add_edge(edge_array[i].first, edge_array[i].second,g);
    char str[2];
    int i=0;
    vertex_descriptor v1=*vertices(g).first,v2=*vertices(g).second;
    while (v1!=v2)
        std::cout << str;
    edge_descriptor from_s,to_t;
    flow = kolmogorov_max_flow(g, s, t);
    return 0;
-------------------------------------------------------------------END OF

The compilation output of the code above includes errors and can be found

Again, if I remove the call to kolmogorv_max_flow, everyting is fine. If I
the call to kolmogorov_max_flow with the line:

write_dimacs_max_flow(g, capacity, identity_property_map(),s, t, std::cout);

The output is:
-------------------------------------- OUTPUT
c DIMACS max-flow file generated from boost::write_dimacs_max_flow
p max 5 6
n 1 s
n 4 t
a 1 2 1
a 1 3 2
a 1 4 3
a 2 4 5
a 3 5 4
a 5 4 4
---------------------------------------- END OF OUTPUT
Which means that the graph was created correctly.

Any suggestions?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at