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

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
                CCoord(int id_,MyFloat x_,MyFloat y_,MyFloat z_, MyFloat w_=0):
id(id_), x(x_), y(y_), z(z_), w(w_){
        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);
  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.

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at