开发者

planar graph with fixed maximum length of edges

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 do开发者_运维问答es 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. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜