1
votes

I want to generate random points in a 2D space, this points will be nodes of a planar graph (built using Gabriel graph algorithm or RNG ).

I wrote java code to do this, but I have two hard problem to solve.

1) I need that all edges of the graph are not longer than a given threshold

2) After I want know faces of graph, a face is a collection of nodes connected by edge. A face does not contain within it other nodes. In image below faces are signed by label (F1, F2...)

How to do these two thing ? some algorithms ? There is some way already known?

Below there is an example of the graph that I must to create

http://imageshack.us/photo/my-images/688/immagineps.png/

1
Can you further define 'faces'? From the picture it looks like a convex hull from a set of points.dfb
a face is a collection of nodes connected by edge. A face does not contain within it other nodes. In image faces are signed by label (F1, F2...) Maybe faces must be only convex, this property could result from the construction of the Gabriel Graph but I'm not sure.tulkas85

1 Answers

1
votes
  1. If you can tolerate some variance in the number of points, then you could modify your Gabriel graph algorithm to be incremental (most of the effort would be making your Delaunay algorithm incremental) and then whenever an edge is too long, insert a random point in the circle having that edge as a diameter.

  2. The most convenient data structures for plane graphs are edge-centric: for example, the doubly-connected edge list and the quad-edge representations. If you're not already using a data structure of this type for the Delaunay step (and I can't imagine why you wouldn't be), you can sort each vertex's outgoing connections by angle. From there, it's easy to implement a function that takes a half-edge and returns the next half-edge on the same face in counterclockwise order. Now iterate through all of the half-edges, and for each half-edge not already visited, iterate around the face until you return to where you started. Label all of the half-edges in the inner iteration as one face.