2

I am trying to understand if a planarity check algorithm (eg. LR Planarity, PC Tree, PQ Tree, etc...) can be enhanced such that some edges are allowed to cross depending on their type.

I have a graph with edges of 3 different types: A,B,C

Edges of type A cannot cross any other edges.

Edges of type B can cross edges of type C and vice versa.

I did already look at a simple LR planarity test, but could not successfully implement this feature.

Is it possible to take an existing algorithm and adjust it with these rules, or is there already an algorithm, which supports this?

Henri
  • 205
  • 1
  • 9

2 Answers2

1

Take the sub-graph containing only the type A edges and use a standard planarity testing algorithm to see if it is planar.

Note: one graph may generate multiple planar embeddings [page 60] so you may need to account for this.

Once you have a planar embedding for the type A edges then you can generate a list of faces.

A path of type B edges that connects from two vertices in the planar sub-graph generated by the type A edges can only be drawn in a planar manner (not crossing any type A edges) if the end-points of the path are both on the boundary of a single face of the embedding. Adding this to the embedding will, by the Jordan Curve theorem, bisect the face into which the embedding was performed and generate two sub-faces.

Note: again, a path may be able to bisect multiple faces so you may have multiple potential embeddings.

Continue performing embeddings of type B edges/paths which connect at both ends to the type A sub-graph and, at each step bisecting a face until you either reach a point where there is no viable face to bisect (and the graph is non-planar) or the type A and type B edges are planar.

Since type C edges can cross type B (and vice-versa) you can embed the type C edges (using the same method of face bisection) into the type A sub-graph without considering the type B edges (since they can be crossed).

While this can be done in O(N) for type A and either B or C (since that is effectively just an ordinary planar embedding), you may have to test multiple embeddings to find an orientation of the faces which works for A, B & C together and the resulting algorithm will almost certainly not be O(N).

Alternatively, if you know the constraints on the permutations of the faces when generating different embeddings then adding in some sort of constraint-based solver to reconcile the orientation of the paths in the embedding may assist.

MT0
  • 143,790
  • 11
  • 59
  • 117
  • I think this might indeed be the best solution. Personally, I looked into adding custom "conflict" rules to a simple LR planarity algorithm - this however only works occasionally if the LR planarity happens to generate the correct embedding... – Henri Apr 20 '17 at 07:12
  • 1
    @Henri The planarity testing algorithm I linked can be used to generate all possible embeddings of a biconnected graph in O(N) time and memory for the first embedding and O(N.P) time for all embeddings (where N is the number of vertices and P is the number of possible embeddings) and talks about generating all possible embeddings for a connected graph (but there probably isn't a O(N.P) algorithm for this). – MT0 Apr 20 '17 at 08:11
0

take the subgraph with edges of typeB and type C with out applying planarity testing, then try to add edges of type A to the subgraph by applying planarity testing algorithm.

Anusha K
  • 14
  • 1
  • The sub-graph formed by B and C edges may be disconnected and is likely to have multiple possible embeddings. How do you determine which embedding to add the A edges to? How do you modify the existing planarity testing algorithms to start with a partially embedded graph? – MT0 Apr 19 '17 at 12:29