Boost logo

Boost Users :

Subject: [Boost-users] newbie question - C++
From: Figa Pelosa (f.pelosa_at_[hidden])
Date: 2010-03-29 12:07:34


hello, I'm using boost for the very first time and I'm having big problems in understanding how to proceed. I'm working in C++, and my aim would be creating a graph where each node is a 2D point and each edge is the distance between two points. I'd like to be able to say "vertex 0 and vertex 1 are 5mm apart". How to do that? This is what I got so far: typedef boost::adjacency_matrix<boost::undirectedS> Graph; class myClass { private: int numberOfNodes; Graph *g; char* name; public: myClass(int); addVertex(float,float,int); void addEdge(int[2],int); }; myClass::myClass(int number)fNodes){ g = new Graph(number_of_nodes); } myClass::addVertex(float x,float y) { add_edge(x,y,*g); } Now this seems to work, but how to incorporate coordinates? Thanks a lot for your help! Ale


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