1

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/

Tomas
  • 57,621
  • 49
  • 238
  • 373
tulkas85
  • 1,103
  • 1
  • 17
  • 43
  • Can you further define 'faces'? From the picture it looks like a convex hull from a set of points. – dfb May 13 '11 at 20:44
  • 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 May 14 '11 at 13:55

1 Answers1

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

qwerty
  • 11
  • 1
  • I solved step one with few change on my code, but I not use Delaunay to create Gabriel Graph. Can you explain how can I find counterclockwise order of edges that share same point ? My data structures is composed by Vector of edge, each edge contain two points. Two edge are linked if share a point. – tulkas85 May 14 '11 at 13:58
  • +1 for this solution. @tulkas85, in most languages you can use something like `atan2()` to determine the angle of a vector relative to the X-axis. Then sort all edges with a common vertex by angle. – brainjam May 14 '11 at 15:59
  • @tulkas85 "but I not use Delaunay to create Gabriel Graph" -> How to you create the graph without Delaunay? I do use Delaunay but rather would like to do without. Even I'm not sure if my graph is correct. I create it by checking the condition `(a, b) is gabriel pair if d^2 (a, b) <= d^2 (a, c) + d^2 (b, c)` for the three points in a Delaunay triangle – embert Jan 19 '14 at 11:41