Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

small cycle finding in a planar graph

I have a geometric undirected planar graph, that is a graph where each node has a location and no 2 edges cross, and I want to find all cycles that have no edges crossing them.

Are there any good solutions known to this problem?


What I'm planning on doing is a sort of A* like solution:

  • insert every edge in a min heap as a path
  • extend the shortest path with every option
  • cull paths that loop back to other than there start (might not be needed)
  • cull paths that would be the third to use ang given edge

Does anyone see an issue with this? Will it even work?

like image 215
BCS Avatar asked May 08 '09 03:05

BCS


People also ask

How do you find the smallest cycle on a graph?

The key idea is that a shortest cycle is comprised of a shortest path between two vertices, say v and w, that does not include edge v-w, plus the edge v-w. We can find the shortest such path by deleting v-w from the graph and running breadth-first search from v (or w).

Can a planar graph have cycles?

Because every 4-connected planar graph contains a triangle (by Euler's formula), Corollary 2.8 implies that if G is a 4-connected planar graph on n≥6 vertices, then G has a cycle of length n−3.

How do you find a cycle in a graph?

There is a cycle in a graph only if there is a back edge present in the graph. Depth First Traversal can be used to detect a cycle in a Graph, DFS for a connected graph produces a tree. If the graph is disconnected then get the DFS forest and check for a cycle in individual trees by checking back edges.

What is a simple cycle in a graph?

A simple cycle is a cycle in a Graph with no repeated vertices (except for the beginning and ending vertex). Basically, if a cycle can't be broken down to two or more cycles, then it is a simple cycle.


3 Answers

My first instinct is to use a method similar to a wall following maze solver. Essentially, follow edges, and always take the rightmost edge out of a vertex. Any cycles you encounter with this method will be boundaries of a face. You'll have to keep track of which edges you've traversed in which direction. Once you've traversed an edge in both directions, you've identified the faces it separates. Once all edges have been traversed in both directions, you'll have identified all faces by their boundaries.

like image 169
user57368 Avatar answered Sep 21 '22 21:09

user57368


A "crossing edge", as you call it, is generally known as a chord. Thus, your problem is to find all chordless cycles.

This paper looks like it may help.

like image 21
John Fouhy Avatar answered Sep 22 '22 21:09

John Fouhy


A simple way to do this is to simply go out and enumerate each face. The principle is simple:

  • We maintain 'α-visited' and 'β-visited' flags for each edge, and a pair of doubly-linked lists of unvisited edges for each such flag. The 'α' and 'β' division should correspond to a partition of the plane on the line corresponding to the edge in question; which side is α and which side is β is arbitrary.
  • For each vertex V:
    • For each adjacent pair of edges E = (V_1, V), E'=(V_2, V) (ie, sort by angle, take adjacent pairs, as well as first+last):
    • Determine which side S of E (S=α or β) V_2 lies on.
    • Walk the tile, starting at V, using side S of E, as described below:

Walking the tile is performed by:

  • Let V = V_init
  • Loop:
    • V_next = the vertex of E that is not V
    • E' = The adjacent edge to E from V_next that is on the current side of E
    • S' = The side of E' that contains V
    • If V_next = V, we have found a loop; record all the edges we passed by on the way, and mark those edge-pairs as visited.
    • If E' = E (there is only one edge), then we have hit a dead end; abort this walk
    • Otherwise, let V = V_next, E = E', S = S' and continue.

I hope this made sense; it perhaps needs some diagrams to explain...

like image 32
bdonlan Avatar answered Sep 20 '22 21:09

bdonlan