|
Boost Users : |
From: Jens Müller (jens.mueller_at_[hidden])
Date: 2006-05-30 17:07:58
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<vecS, vecS, undirectedS,
property<vertex_name_t, std::string,
property<decomposition_index_t, int,
property<coordinates_sq_t, simple_point<double>,
property<coordinates_circle_t, Polar<double>,
VParams > > > > > MyGraph;
(Before it was Graph instead of MyGraph).
The compiler error is not really enlightening to me:
ens_at_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::vecS, boost::vecS, boost::undirectedS,
boost::property<boost::vertex_name_t, std::string,
boost::property<decomposition_index_t, int,
boost::property<coordinates_sq_t, boost::simple_point<double>,
boost::property<coordinates_circle_t, Polar<double>, VParams> > > >,
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 <boost/graph/fruchterman_reingold.hpp>
#include <boost/graph/random_layout.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/simple_point.hpp>
#include <boost/lexical_cast.hpp>
#include <string>
#include <iostream>
#include <map>
#include <vector>
#include <boost/random/linear_congruential.hpp>
#include <boost/progress.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/small_world_generator.hpp>
#include <boost/random/linear_congruential.hpp>
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<vecS, vecS, undirectedS,
property<vertex_name_t, std::string,
property<decomposition_index_t, int,
property<coordinates_sq_t, simple_point<double>,
property<coordinates_circle_t, Polar<double>,
VParams > > > > > Graph;
typedef property_map<Graph,coordinates_sq_t>::type CoordSqMap;
typedef property_map<Graph,coordinates_circle_t>::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_ptr<boost::progress_display> display;
};
typedef boost::small_world_iterator<boost::minstd_rand, Graph> 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?
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