How to find the 'outline' of a (concave) graph in 2D plane? - algorithm

I have a connected graph in 2D plane composed of some vertices and some edges defined between them. The overall shape of the graph is not necessarily convex, i.e. the adjacent vertices on the convex hull are not always connected by an edge. Now is there an existing algorithm that finds the 'outline' of this graph? The issue that's troubling me the most is that this outline polygon may contain vertices that are not vertices in the original graph, but rather the intersection of two edges, so I'm not quite sure how to deal with it...
Thanks!
Niko

Related

Extracting only bounded faces from undirected connected planar graph with possibly curved edges

I want to extract only bounded faces from an undirected connected planar graph where edges are represented as straight lines or quadratic/cubic Bézier curves, and they don't intersect each other. I did it successfuly for graphs with only straight line edges following this paper. My algorithm goes like this.
Find the 2-core of the graph. Use the 2-core instead of the entire graph.
Pick a vertex V and a directed edge V->U. Mark V->U as visited.
Find edge U->W such that the counterclockwise angle from U->V to U->W is the minimum. Mark U->W as visited.
If W is the initial vertex, a face is found. Else put U in place of V and U->W in place of V->U and repeat 3.
Let V1V2...Vn be the face found. Find k such that the directed edge Vk->Vk-1 is unvisited. Restart 2 with initial vertex Vk and edge Vk->Vk-1. If there is no such k, pick any unvisited edge and restart.
Remove the only face with different orientation. This face represents the unbounded exterior region.
I calculated the orientation of faces with this answer.
But if there are curved edges, the situation is different. First, I modified step 2 so that we compare the angle between tangent vectors instead. Now, I have trouble at step 6. The convex hull of a face could contain no vertices, so that answer doesn't work. In this case we can instead grab a point on a curve with minimal y coordinate and calculate the sign of the curvature, but it seems too inefficient. Is there a way to calculate orientation more efficiently, or is there another way to distinguish unbounded region from bounded regions?

Optimal algorithm to check which vertices in a set of polygons can be connected to a point without overlap

I have a set of polygons described by their vertices. My question is, given a certain vertex, how can I find the vertices of all the polygons to which I can draw a line segment from the given vertex without overlapping the polygons.
Is it possible to do in less than O(n^2)?

Outermost Polygon from a set of Edges

Suppose I have a set of 2d line segments that are all connected. I need an algorithm that finds the outermost segments in the set. That is, the minimal subset that bounds the same region.
Note: this is not the same as finding the convex hull of the points making up the segments.
Edit:
On the top is the initial set of segments.
Below that is the same outline with interior segments deleted.
(Ignore the little grey crosses, they're just to mark intersection points.)
How would you do that with a pencil...?
Find the leftmost vertex (minimum x). If there's more than one, choose the lowest of them (minimum y). There is no vertex below the current one, so take the direction 'downwards' as a reference.
Find all edges going from the current vertex and calculate their directions (bearings). Find the one which makes the smallest positive angle (counter-clockwise) from the reference direction. That will be the outline segment.
Select its other end as your new 'current' vertex and set the direction from that vertex to the recent one as a new reference direction.
Proceed from step 2 until you arrive to the start vertex.
Remove all unvisited segments.
Remove all orphaned vertices (if any appeared in step 5).
Given a triangulated non-convex polygon you can specify the direction of vertices traversal (clockwise of CCW). Make all the triangles to be similarly oriented WRT traversal of its vertices. Do decompose all the triangles into directed edges. Every edge for every triangle is the tuple of two vertices (a, b). For each neighbouring triangles you have two contradirectional edges (a, b) and (b, a). You can simply exclude such a pairs of edges from further consideration. Finally you will obtain a set of exclusively outer edges.
There is no loss of generality if your polygon consists of non-simplicial parts (but still you can specify the direction of vertices traversal).
Triangulation of the source segments-constructed polygon is evident step: stretching the vertices onto $d + 1$ paraboloid and triangulation, then excluding triangles, containing at least one edge that match no one source segment.
Another possible approach is slightly modified Gift wrapping algorithm.
The following is an approach that starts with the convex hull then works its way inward. The intuition is that you start with edges on the hull, then you fill in gaps by finding the closest point "along" the gap by following the shortest path in your edge set.
Compute the convex hull of your points.
Intersect the hull set with your edge set. This will leave you with a series of, potentially disconnected, edge paths.
Any point that does not have two edges (i.e., a leaf in graph terms) is connected to its closest leaf by finding the shortest path in the original edge set.
Any ties can be broken by a path that makes the smallest area when closed off by the hull.

How to draw graph with disjoint edges?

I have adjacency matrix for graph. I need to vizualize this graph without intersecting edges.
Vertex in the graph can be arranged randomly. I know one solution - enumeration of all edges for intersections. If the edges intersect, then rearrange the vertex, but it's too expensive for a large number of vertexes (more than 20).
Any other ideas how to check for intersecting edges?
It's really easy to visualise any graph in a 3D plane with disjoint edges.
1) Place all the vertices in any point in the 3D plane such that no three vertices are collinear and no four vertices are in same plane.
2) Traverse through the adjacency matrix and draw a line/curve to connect the vertices.
In a 2D plane it's not guaranteed for the existence of a solution. For example take the worst case scenario that there are some 10 vertices and every vertex is connected to each other.

An algorithm to draw graphs without checking all pairs of vertices?

Graph drawing algorithms, such as those described here, check all the vertices two-by-two and apply additional forces if two vertices are connected by an edge. If we have a very large graph, checking all pairs of vertices would be costly. Is there any graph drawing algorithm that draws a large graph using only existing edges, not by verifying all possible pairs?
EDIT
By drawing algorithm, I meant an algorithm that assigns a 2D or 3D position to each vertex such that rendering spheres or circles (or any other shape) as vertices at their assigned positions lead to a plausible visual representation of the whole graph.
Check this Spring-Electrical Embedding
It is in O(nlog n).
If you have sparse matrix you can consider about creating graph as list of neighbours or simplier like pair of vertices (e.g. (1, 3) and 1 and 3 are the numbers of vertices).

Resources