[ create a new paste ] login | about

Project: boost
Link: http://boost.codepad.org/4shcGgCy    [ raw code | output | fork ]

C++, pasted on Jun 20:
#include <iostream>
#include <boost/graph/iteration_macros.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/compressed_sparse_row_graph.hpp>

using namespace std;
using namespace boost;

int main(int argc, char* argv[]) {
        typedef pair<unsigned int, unsigned int> E;
        E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5),
                    E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0),
                    E(5, 2) };
        list<E> v(&the_edges[0], &the_edges[0] + sizeof(the_edges)/sizeof(E));
        adjacency_list<vecS, vecS, bidirectionalS> G(v.begin(), v.end(), 6);

        compressed_sparse_row_graph<bidirectionalS> B(G);
        typedef adjacency_list<vecS, vecS, bidirectionalS> adjGraph;

        BGL_FORALL_VERTICES(v, G, adjGraph) {
                int outDegree = out_degree(v, G);
                int inDegree = in_degree(v, G);
                cout << v << " " << outDegree << " " << inDegree << endl;
        }

        BGL_FORALL_VERTICES(v, B, compressed_sparse_row_graph<bidirectionalS>) {
                int outDegree = out_degree(v, B);
                int inDegree = in_degree(v, B);
                cout << v << " " << outDegree << " " << inDegree << endl;
        }
}


Output:
1
2
3
4
/usr/include/boost/graph/compressed_sparse_row_graph.hpp: In instantiation of 'boost::compressed_sparse_row_graph<boost::bidirectionalS, void, void, boost::no_property, unsigned int, unsigned int>':
t.cpp:18:   instantiated from here
Line 113: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>' 
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: