0

I have a directed planar Graph. Therefore I can make a planar embedding. I have to nodes s and t and I would like to find the leftmost path between s and t according to a specific embedding.

Left is defined as David described in the comment. That means "Left" is defined with respect to an infinite face and a clockwise/counterclockwise convention. A path p is left of a path q with the same endpoints if the cycle p*rev(q) is at least as counterclockwise with respect to winding the infinite face as any other face.

How is that possible? I have no idea how to tell my programm if a path is left of another one. I read a few paper, but they didn't explain how to implement that. Does someone has an idea?

Mark Token
  • 25
  • 6
  • Might belong to programmers.stackexchange.com – Marco A. May 06 '14 at 12:47
  • What do yo mean by "left"? – iavr May 06 '14 at 12:53
  • @iavr "Left" is defined with respect to an infinite face and a clockwise/counterclockwise convention. A path p is left of a path q with the same endpoints if the cycle p\*rev(q) is at least as counterclockwise with respect to winding the infinite face as any other face. – David Eisenstat May 06 '14 at 13:44
  • Ping me if this question gets reopened (and as a purely strategic thing, don't tag language-agnostic questions with the programming language that you happen to be using, because the new audience that you get is more likely to put it on hold). – David Eisenstat May 06 '14 at 13:48
  • @user3399670 Can you point to the papers you've read? – iavr May 06 '14 at 13:54
  • Here's a link to my advisor's draft book on planar graph algorithms: http://planarity.org/ , which should have all of the relevant definitions. – David Eisenstat May 06 '14 at 13:57
  • http://cs.brown.edu/~pnk/publications/st-flow.pdf – Mark Token May 06 '14 at 14:06
  • @user3399670 Ah. Some combination of Jeff Erickson and Philip and me recently proved that you don't actually need to initialize leftmost. – David Eisenstat May 06 '14 at 14:07
  • H. Ripphausen-Lipa, D. Wagner, and K. Weihe. The vertex-disjoint menger problem in planar graphs. In 4th SODA, pages 112–119, 1993. – Mark Token May 06 '14 at 14:09
  • There's an implementation of Borradaile--Klein linked from this page: http://vision.csd.uwo.ca/code/ – David Eisenstat May 06 '14 at 14:10
  • Answer that I can't post due to robo-reviewers: http://pastebin.com/xMqhXsqm – David Eisenstat May 06 '14 at 15:04
  • Thank you very much, David =) Acutally I like to implement the max flow algorithm by Borradaile and Klein with different Dynamic Trees. Do you mean with not initializing leftmost that the graph can have positive cycles? Does that means that the maxflow algorithm can be used on every possible planar graph without restriction? – Mark Token May 07 '14 at 22:42
  • @DavidEisenstat could you please point to the paper where Erickson, Klein and you proved that you don't actually need to initialize leftmost? – Mark Token May 15 '14 at 14:32
  • [Linear-time algorithms for max flow and multiple-source shortest paths in unit-weight planar graphs](http://www.davideisenstat.com/cv/EisenstatK13.pdf) (That part of the correctness proof doesn't require unit weights.) – David Eisenstat May 15 '14 at 14:33
  • @DavidEisenstat Thanks – Mark Token May 15 '14 at 16:05

2 Answers2

0

A simple planar graph has no notion of left and right, it can be mirrored and rotated still being planar. You have to embed some kind of direction into the graph.

If the maximum out degree of a node is 2 you can label the left edge. To find the left most path you can make a depth first search starting from s. When you reach a new node always take the left edge first. The algorithm should terminate when t is reached, leaving you the the left most path.

In the case of arbitrary maximum out degree you can label the edges with increasing numbers from left to right.

  • Yes, but how do I know what the left edge is. For example I have a list of out edges of a vertex v. How do I know which one is the leftmost one? – Mark Token May 06 '14 at 13:50
  • If "left" is defined as given by David Eisenstat in his comment, then this depends on both endpoints `s` and `t`, so edges cannot be really labeled. – iavr May 06 '14 at 13:53
  • @user3399670 It's context-dependent. I was trying to post an answer before the hold came, of which the tl;dr is choose the infinite face incident to t; then rightmost with respect to t is defined. Do a DFS traversal; then rightmost is defined with respect to the incoming half-edge of the current traversal location. (Leftmost from s <=> rightmost from t.) – David Eisenstat May 06 '14 at 13:55
0

As user3568609 notes, the planar embedding is on a sphere, with no natural definition of left and right. You need to choose an infinite face first; for flow algorithms (I assume that this is what you’re implementing), it’s often convenient to choose a face incident to s or t. Let’s suppose that the infinite face is incident to t. The counterclockwise order of half-edges into t now has a natural gap where the infinite face is.

.4  3| /2  .
 \___|/___/
     t  1

(infinite face)

Visit the half-edges in counterclockwise order, 1 to 4 in the example. This is a depth-first traversal, so we fully explore 1’s connections before 2’s, etc. When you arrive at another vertex v from another vertex u then the picture looks like this

|3   |2
 \___|___/1
     v
     |
     u

Once again I’ve labeled the proper traversal order.

David Eisenstat
  • 52,844
  • 7
  • 50
  • 103