user813182
user813182

Reputation:

Defining boost compressed sparse row graph

I know this might be obvious, but bear with me my generic programming background is weak.

This is the code I am trying to compile :

#define BOOST_GRAPH_USE_NEW_CSR_INTERFACE
#include <boost/graph/compressed_sparse_row_graph.hpp>
#include <vector>

typedef unsigned int uint32_t;
typedef unsigned long uint64_t;

using namespace boost;
using namespace std;

typedef compressed_sparse_row_graph<directedS,void,void,no_property,uint32_t,uint64_t> intl_graph;
typedef std::pair<uint32_t,uint32_t> E;

int main()
{
    intl_graph g;
    vector<E> the_edges;
    uint32_t nv = 3;
    uint64_t nedge;

    the_edges.push_back(E(0,1));
    the_edges.push_back(E(1,2));

    g = intl_graph(edges_are_unsorted_t,the_edges.begin(),the_edges.end(),nv); //line 24
}

which results in this error :

boost_eg.cpp: In function âint main()â:
boost_eg.cpp:24: error: expected primary-expression before â(â token
boost_eg.cpp:24: error: expected primary-expression before â,â token

If I change line 24 to this :

intl_graph g_(edges_are_unsorted_t,the_edges.begin(),the_edges.end(),nv);

the error is this :

boost_eg.cpp: In function âint main()â:
boost_eg.cpp:24: error: âthe_edgesâ is not a type
boost_eg.cpp:24: error: expected â,â or â...â before â.â token

Any thoughts?

The reference is over here :

http://www.boost.org/doc/libs/1_49_0/libs/graph/doc/compressed_sparse_row.html

Upvotes: 0

Views: 554

Answers (1)

VincentL
VincentL

Reputation: 26

You have to replace

g = intl_graph(edges_are_unsorted_t,the_edges.begin(),the_edges.end(),nv); //line 24

by

g = intl_graph(edges_are_unsorted,the_edges.begin(),the_edges.end(),nv); //line 24

Upvotes: 1

Related Questions