I have a graph where nodes represent points in 3D space. Each node is connected only to all other nodes within some cutoff radius. I am trying to enumerate all subgraphs such that the nodes represent the vertices of a polyhedron with no interior nodes or edges.
At first I thought this was clique problem, but the requirement that all nodes are adjacent to each other isn't working for me. The opposite corners of a cube aren't going to be connected in my dataset, but I need to be able to pull out the cube.
I don't really have a formal education in CS, so I'm not really sure what to search for, but hopefully someone with a better domain vocabulary than me can point me in the right direction.
One way to attack this problem seem to me to use a 3D triangulation "tetrahedrisation". CGAL can be of service there. Then you can start generating different polyhedrons by sticking together neighboring tetrahedrons from the triangulation (as long as they don't inclose another vertex in their combined interior).
Related
I'm trying to find a way to reverse the Voronoi algorithm.
Basically, having some connected shapes which mostly consist of triangles and squares, I'm trying to find the set of points which, by using the Voronoi algorithm would recreate the initial shapes.
Introduction.
This problem has been solved in a paper by Biedl et al. in 2013 after a partial solution by Ash and Boker in 1985. In case your Voronoi nodes are all of odd degree then the algorithm by Ash and Bolker works for you.
First of all note that there might not be the point set but many point sets all having the same Voronoi diagram you ask for. For instance, consider this picture
taken from this website. The red point set and the blue point set give you the same black Voronoi diagram. (And, by the way, the straight skeletons of the red and blue polygon coincide with the Voronoi diagrams of the point sets as well.)
Overview of the algorithm.
The rough idea is the following. Assume an oracle told you one candidate point in a Voronoi cell. Then you can mirror this point to neighboring Voronoi cells by the common edges between the neighboring cells, and keep on propagating.
But there could be troubles: The mirrored point may lie outside the neighboring cell. Also if you consider a Voronoi node and the incident cells then you can keep propagating the point around one cycle by the incident Voronoi edges, but you may not end up at the original point again.
So what the paper does is the following:
It gives sufficient and necessary conditions for your input to form a Voronoi diagram.
It tells you how to choose a valid starting point if such a point exists. Actually, it gives you set of all possible starting points.
The second part works roughly as follows: For each Voronoi cell one knows a "region" where the point has to lie by investigating the Voronoi nodes of the cell. Then take a spanning tree of the dual graph of the Voronoi diagram and choose an arbitrary root. For every cell you have a unique "mirroring path" to the "root cell". Apply the mirroring sequences of the regions mentioned above and intersect the mirror images.
The intersection is the set of all possible starting points. If it is empty then your input was not a Voronoi diagram.
Further simplification.
In case your Voronoi nodes are of odd degree then the problem is much simpler. Consider Fig-4 in the paper by Biedl et al. to find out for each node the lines where the points must lie on. If a Voronoi cell has two nodes of odd degree then you can intersect these lines and get the single possible candidate point. You can do this for every Voronoi cell.
Wouldn't finding the centroid of every triangle give you a point that is by definition, as far as possible from the other points.
I am trying to reconstruct a road network from a set of GPS coordinates.
I have done some research, but most existing algorithms seem to rely on having information about which coordinates are from the same car. I do not have any information on which points lie on a trace together. As a first step I am assuming that the coordinates are 100% accurate, to make it simpler. I realise that adding points at cross sections will be necessary to ensure there are no intersections. I also assume there are no roads going over or under each other.
So what I have: A set of points in a 2D plane.
What I need to compute: A fully connected network that connects all of these points. This should be the most likely road network.
Does anyone have any thoughts on how to go about doing this?
I thought about starting off with a minimum spanning tree and going from there. But I have no idea what to do next.
I'm assuming you have no information about the point. So dependent on your dataset, you could bruteforce it.
Start with a random point, find the closest point to this, connect these. Move to the new point, and find the closest point not connected to this. And then spread out from there.
You probably need to do some gymnastics to some cases, like endpoints, or when there are a long distance between two points that should be connected.
I'll try to give some examples when I get home later today, if you need it.
What I need to compute: A fully connected network that connects all of these points. This should be the most likely road network.
Does anyone have any thoughts on how to go about doing this?
Not at all. It's impossible, unless you make a lot more statements about your individual positions.
So what I have: A set of points in a 2D plane.
Look at it as a graph problem: You've got a bunch of nodes (your GPS coordinates) with no edges. So that's a graph, yes, but a totally disconnected one, hence:
I thought about starting off with a minimum spanning tree and going from there.
Citing Wikipedia:
A minimum spanning tree is a spanning tree of a connected, undirected graph. It connects all the vertices together with the minimal total weighting for its edges.
That would require having a connected graph. You don't have one.
So how would you start connecting your points? You only have a set of points; a set as it isn't even ordered! Will you connect points to their nearest neighbor, ensuring some sort of restriction on the edges per node? Won't work in urban areas at all – there's main roads that are broader than the distance between back alleys, for example, under- and overpasses, a lot of streets that have lanes going in incompatible directions etc.
I have a convex triangulated mesh. I am able to numerically calculate geodesics between points on the surface; however, I am having trouble tackling the following problem:
Imagine a net being placed over the mesh. The outside boundary of the net coincides with the boundary of the mesh, but the nodes of the net corresponding to the interior of the net are allowed to move freely. I'm interested in finding the configuration that would have the least stress (I know the distances for the at rest state of the net).
Doing this on a smooth surface is simple enough as I could solve for the stresses in terms of the positions of the nodes of the net; however, I don't see a way of calculating the stresses in terms of the position of the net nodes because I don't know that a formula exists for geodesics on a convex triangulated surface.
I'm hoping there is an alternative method to solving this such as a fixed point argument.
Hint:
If I am right, as long as a node remains inside a face, the equations are linear (just as if the node was on a plane). Assuming some node/face correspondence, you can solve for the equilibrium, as if the nodes did belong to the respective planes of support, unconstrained by the face boundaries.
Then for the nodes which are found to lie outside the face, you can project them on the surface and obtain a better face assignment. Hopefully this process might converge to a stable solution.
The picture shows a solution after a first tentative node/face assignment, then a second one after projection/reassignment.
On second thoughts, the problem is even harder as the computation involves geodesic distances between the nodes, which depend on the faces that are traversed. So the domain in which linearity holds when moving a single node is even smaller than a face, it is also limited by "wedges" emanating from the lined nodes and containing no other vertex.
Then you may have to compute the domains where the geodesic distances to a linked neighbor is a linear function of the coordinates and project onto this partition of the surface. Looks like an endeavor.
I want to find the nearest edge in a graph. Consider the following example:
Figure 1: yellow: vertices, black: edges, blue: query-point
General Information:
The graph contains about 10million vertices and about 15million edges. Every vertex has coordinates. Edges are defined by the two adjacent vertices.
Simplest solution:
I could simply calculate the distance from the query-point to every other edge in the graph, but that would be horribly slow.
Idea and difficulties:
My idea was to use some spatial index to accelerate the query. I already implemented a kd-tree to find the nearest vertex. But as Figure 1 shows the edges incident to the nearest vertex are not necessarily the nearest to the query-point. I would get the edge 3-4 instead of the nearer edge 7-8.
Question:
Is there an algorithm to find the nearest edge in a graph?
A very simple solution (but maybe not the one with lowest complexity) would be to use a quad tree for all your edges based on their bounding box. Then you simply extract the set of edges closest to your query point and iterate over them to find the closest edge.
The extracted set of edges returned by the quad tree should be many factors smaller than your original 15 million edges and therefore a lot less expensive to iterate through.
A quad tree is a simpler data structure than the R-tree. It is fairly common and should be readily available in many environments. For example, in Java the JTS Topology Suite has a structure QuadTree that can easily be wrapped to perform this task.
There are spatial query structures which are appropriate for other types of data than points. The most general is the "R-tree" structure (and its many, many variants), which will allow you to store the bounding rectangles of your line segments. You can then search outward from your query points, examining the segments in the bounding rectangles and stopping when the nearest remaining rectangle is further than the closest line encountered so far. This could have poor performance when there are many long line segments overlapping, but for a PSLG such as you seem to have here, that shouldn't happen.
Another option is to use the segments to define a BSP tree, and scan outwards from your point to find all the "visible" lines. This in turn will be problematic if your point can see many edges.
Without proof:
You start with a constrained Delaunay Triangulation, that is a triangulation that takes the existing edges into account. E.g. CGAL or Triangle can do this. For each query point you determine which triangle it belongs to. Then you you only have to check the edges touching a corner of that triangle.
I think this should work in most cases, but there are certainly corner cases where it fails, e.g. when there are many vertices without any edge at all, so at least you have to remove those empty vertices.
You can compute the voronoi diagram and run a query on each voronoi cell. You can subdivide the voronoi diagram to get a better result. You can combine metric and voronoi diagram:http://www.cc.gatech.edu/~phlosoft/voronoi/
you could insert extra vertices in long edges to get some approximation based on closest vertices ..
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/
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.
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.