Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Auto Connect vertexes by predicate?
From: arm2arm (arm2arm_at_[hidden])
Date: 2009-05-08 18:37:26

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:
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.



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

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