Hello, Oh, no I do not have 3D grid I have only points. To clear: My task is following: Find the cluster of the points in 3D. There is a known algorithm widely used in astrophysics: Friends of Friends (FOF)( for ex: http://www-hpcc.astro.washington.edu/tools/afof.html). You link in to the group all particles with given the distance (linking length - LL). The more general extended method is MST (minimum spanning tree) based groups. So you link particles in 3d with only closest neighbor. Then you cut and separate all groups by given maximum LL. I would like to implement this algorithm by BGL. Using STL stack sorted by distance I can make pairs and put them one by one to the graph (your suggestion #3) , but I would like to know for more efficient way to do it. Thanks Arman. Sorry -- I misunderstood your question and assumed you wanted to create a grid on a 3-D lattice. If you already have a list of vertex pairs that you want to use as edges, just pass the begin and end iterators of that list (vector, etc.) to the graph constructor. If you are willing to sort the vertex pairs in advance and will not be mutating the graph's structure, you can use compressed_sparse_row_graph to save memory and computation time. Is that closer to what you wanted? I don't fully understand what you are computing from the points and what you want the BGL graph to contain. -- Jeremiah Willcock _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users -- View this message in context: http://www.nabble.com/-BGL--Auto-Connect-vertexes-by-predicate--tp23451992p2... Sent from the Boost - Users mailing list archive at Nabble.com.