Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Auto Connect vertexes by predicate?
From: arm2arm (arm2arm_at_[hidden])
Date: 2009-05-08 15:40:11


Hello,
Are there ways to generate Graph with edges by the user defined function?
Should I generate Vertex relations by hand then put it in to Graph?
I would like to feed graph by points 3d and each point is linked to its
closest neighbor by distance. Then as a next step I would like to dig in the
graph the sub-graphs with the given linking length.
My Data structure is following:
_____________________
class CCoord
        {
        public:
                CCoord(){};
                CCoord(int id_,MyFloat x_,MyFloat y_,MyFloat z_, MyFloat w_=0):
id(id_), x(x_), y(y_), z(z_), w(w_){
                if(w==0.0)
                        w=sqrt(x*x+y*y+z*z);
        };
        MyFloat x, y, z;
        int id;
        MyFloat w;
}

typedef std::vector<CCoord> typeVecData;
  typedef adjacency_list < vecS, vecS, undirectedS,
    no_property, property < edge_weight_t, MyFloat > > Graph;
  typedef graph_traits < Graph >::edge_descriptor Edge;
  typedef graph_traits < Graph >::vertex_descriptor Vertex;
  typedef std::pair<int, int> E;

  typeVecData data(num_nodes);
  srand(0);
  generate(data.begin(),data.end(),gencoord);
  typedef std::pair<int, int> Edge;

Graph G(5);
  add_edge(0, 2, G);//how to apply relation function?
________________________________________________

What is the correst way to implement this algorithm using BGL?

Thank you beforehand.
Arman

-- 
View this message in context: http://www.nabble.com/-BGL--Auto-Connect-vertexes-by-predicate--tp23451992p23451992.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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