I switched from 1.33.1 to CVS, and after that, my test programm did not
work any longer ...
The relevant part is:
typedef adjacency_list > > > > MyGraph;
(Before it was Graph instead of MyGraph).
The compiler error is not really enlightening to me:
ens@fairtrade ~/c++ $ LC_ALL=en g++ -O3 my_fr.cpp
my_fr.cpp:50: error: `Graph' was not declared in this scope
my_fr.cpp:50: error: template argument 1 is invalid
my_fr.cpp:50: error: `type' does not name a type
my_fr.cpp:51: error: `Graph' was not declared in this scope
my_fr.cpp:51: error: template argument 1 is invalid
my_fr.cpp:51: error: `type' does not name a type
my_fr.cpp:54: error: `Graph' was not declared in this scope
my_fr.cpp:54: error: template argument 1 is invalid
my_fr.cpp:54: error: `vertex_descriptor' does not name a type
my_fr.cpp:76: error: `Graph' was not declared in this scope
my_fr.cpp:76: error: template argument 2 is invalid
my_fr.cpp:76: error: ISO C++ forbids declaration of `SWGen' with no type
my_fr.cpp: In function `int main()':
my_fr.cpp:83: error: use of `Graph' is ambiguous
my_fr.cpp:49: error: first declared as `typedef class
boost::adjacency_list > > >,
boost::no_property, boost::no_property, boost::listS> Graph' here
/usr/local/include/boost/graph/graph_concepts.hpp:31: error: also
declared as `template<class G> struct boost::Graph' here
my_fr.cpp:83: error: `Graph' was not declared in this scope
my_fr.cpp:83: error: expected `;' before "g"
my_fr.cpp:88: error: `CoordSqMap' was not declared in this scope
my_fr.cpp:88: error: expected `;' before "position"
my_fr.cpp:89: error: `g' was not declared in this scope
my_fr.cpp:89: error: `position' was not declared in this scope
Old program:
#include
#include
#include
#include
#include
#include <string>
#include <iostream>
#include <map>
#include <vector>
#include
#include
#include
#include
#include
#include
using namespace boost;
struct decomposition_index_t{
typedef vertex_property_tag kind;
};
struct coordinates_sq_t{
typedef vertex_property_tag kind;
};
struct coordinates_circle_t{
typedef vertex_property_tag kind;
};
template<typename T>
struct Polar {
T rad;
T angle;
};
struct VParams {
int a;
double b;
long c;
// std::complex<double> d;
};
typedef adjacency_list > > > > Graph;
typedef property_map::type CoordSqMap;
typedef property_map::type CoordCMap;
typedef graph_traits<Graph>::vertex_descriptor Vertex;
class progress_cooling : public linear_cooling<double>
{
typedef linear_cooling<double> inherited;
public:
explicit progress_cooling(std::size_t iterations) : inherited(iterations)
{
display.reset(new progress_display(iterations + 1, std::cerr));
}
double operator()()
{
++(*display);
return inherited::operator()();
}
private:
shared_ptrboost::progress_display display;
};
typedef boost::small_world_iterator SWGen;
int main()
{
boost::minstd_rand gen;
// Create graph with 10000 nodes
int nodecount = 4000;
Graph g(SWGen(gen, nodecount, 6, 0.03), SWGen(), nodecount);
double width = 2;
double height = 2;
CoordSqMap position = get(coordinates_sq_t(), g);
random_graph_layout(g, position, -width/2, width/2, -height/2,
height/2, gen);
int iterations = 20;
fruchterman_reingold_force_directed_layout
(g, position, width, height,
cooling(progress_cooling(iterations)).force_pairs(all_force_pairs()
) );
return 0;
}
Can someone explain to me what's happening here?