VISIBILITY GRAPHS

Presentation

by

Akhil Gupta

akhilg@cse.iitk.ac.in


Algorithm to construct visibility graph in O(n^2) time:


I

                                                    Fig 1. Input to the algorithm                                                                   Fig 2. Output- the visibility graph

Input: n line segments

Output:  visibility  Graph

Notation used:

S:- Set of n line segments

Gs = (Vs, Es) - Visibility Graph

s(v) - segment to which v belongs

d(v,v') - direction from v to v'

Ds - sorted set of directions d(v,v')

s(inf) - line segment at infinity

v(inf) - vertex point at infinity

S(inf) - union of set S and s(inf)

R , a subset of Vs x  S(inf) -
                It is a view relation that stores the pair of segments and the vertices (v,s(v)) s.t. s(v) is the segment visible from vertex v along a direction d

The algorithm improves the complexity by reducing the time taken to sort directions d(v,v') to generate Ds

Idea behind the Algorithm:

The algorithm is a variation of the sweep-line algorithm and like it, works by rotating a line updating information about the topology of vertices, building the visibility graph in process. The information is stored in a relation R.  The bottleneck in this approach is the sorting of the directions in which the line needs to be rotated.

relation R between the vertices and the segment
 Fig 2. This figure shows the initial relation R0 for a set of segments.
The dotted line from each vertex v points to the segment s,
for which (v,s) belongs  to R0

The algorithm circumvents this problem by avoiding to sort the directions. Rather it uses a permutation of them which can be computed in lesser time and serves the same purpose.

When we rotate the sweep line, the relation R0 does not change till we reach the next direction in Ds.  Even then, the relation changes locally. There are four cases possible.


Fig 3: These are the four cases that can arise  in sweep line rotation.
In case (i),  No edge needs to be added to the graph.
In case (ii), the edge from v to line 2 is added to the graph.
In case (iii), the edge from v to line 2 is added.
In case (iv), no edge is added.





INITIALIZE R0:
for every point v belonging to Vs, let (v,s) belong to R,
                s.t. s is the first line intersected by the ray emanating from v in the vertical direction downwards.

UPDATE R:

if s(v') = s(v) then /* case (i) */
    edge(R,d) = phi and rot(R,d) = R;
else if  length(vv') < length(vw) /* case (ii) */
    edge(R,d) = {{v,v'}} and
     rot(R,d) = R - {(v,R(v))} + {(v,s(v'))};
else if  s(v') = R(v) /* case (iii) */
    edge(R,d) = {{v,v'}} and
     rot(R,d) = R - {(v,R(v))} + {(v,R(v'))};
 else if  length(vv') > length(vw) /* case (iv) */
    edge(R,d) = phi and
     rot(R,d) = R;
 

ALGORITHM:
    INITIALIZE R0
    Es = phi ; R = R0
    for i =1 to (2n C 2) do
        UPDATE R;
        Es = Es U edge (R,di)
        R = rot(R, di);
    end;
 
 

  • It is clear from the algorithm that UPDATE R can be computed in O(1) time,  R0 can be computed in O(nlog n).
  • The bottleneck is the computation of Ds since the best upper bound for it is O(n^2log n).
  • It can be resolved using " independent" directions.

  • Independent Directions : Two directions d = d(v,w) and d' = d(v',w') are independent if {v,w} intersection {v',w'} = phi.

    Independent directions have a special property that if we change two consecutive independent directions in Ds, Es is still computed correctly.

    Thus, instead of using the sorted set Ds, we can use a permutation of Ds, obtained by interchanging independent directions, called a "good permutation".

    Good permutation can be computed in O(n^2) time!!!
     

    Computation of good permutation of Ds.
     

  • Use of Dual Space.

  •     As be arrangement of lines dual to Vs i.e for every v = (a,b) belonging to Vs, there is a line T = ax+b in As. Then, every intersection (a',b') of two line T and T' in As corresponds to line -a'x + b' passing through v and v'. This line is the direction d(v,v').
     
  • Construct a graph G(As) where the points of intersection are nodes and two nodes d and d' are joined if and only if d is to right of d' and d and d' lie on a common line in  As.
  • If there is no path from a node d to another node d' in this graph, then these two nodes are independent.
  • Topological sorting of this graph gives a good permutation of Ds.

  • Complexity of algorithm is  O(n^2).
     



     
     

    GENERALIZED  POLYGONS

     A generalized polygon  has following properties
     

  • subset of R^2
  • homomorphic to disc
  • boundary is a closed loop of straight lines and arcs

  • Types of generalized polygons
     

  • 1. Convex
  • 2. Non-Convex

  •  

     
     


                                                                       Fig 4. Convex generalized polygon                                                                              Fig 5. Non-convex generalized polygon
     

    Reduced Generalized Visibility Graph:

    The reduced generalized visibility graph consists of
     

  • start point, goal point and convex nodes of the polygon are nodes
  • XX' is an edge s.t
  •     E and E' are circular edges and there exists X belonging to E and X' belonging to E' s.t. XX' is in free space and is tangent
  •  Every straight lime of polygon connecting convex points

  •  

     



     
     

    VISIBILITY GRAPHS IN THREE DIMENSIONS:
     

  • NP -HARD - Canny
  • 2^(n^O(1)) time algorithm proposed by Reif and Strofer

  • Papadimitrou gave an approximation algorithm of polynomial time

        Given a positive real number e, it returns path whose length is at most (1+e) times the shortest path length. The algorithm works by dividing the lines into segments and constructing an approximate visibility graph using these segments as nodes.

    The NP-hardness of the problem arises out of the difficulty faced in finding out the distance between two line segments in three dimensions.

    ALGORITHM:

    1. Divide all edges of  the C-space of obstacles into several segments.
    2. The segments are assumed to be small enough to approximate the distance between the a pair of segments as the distance between the mid points of the segment.
    3. Using segments as nodes, a visibility graph is constructed where two nodes representing a pair of segments are connected if they are visible to each other.
    4. After the construction of the graph, standard graph search algorithms are used to search for a path.
     

    Computation of Visibility Graph:

    For a pair of lines dividing into segments, fix a coordinate system (x,y) s.t (a,b) represents the path segment on line 1 and both segment on line 2.

    This reduces the problem to that of finding a region R, which represents pair of segments visible to each other.

    R is calculated using advanced coordinate geometry , which is a union of hyperbolic regions.

    Once, R is calculated, the visibility graph is constructed by traversing the boundary of R, and for all points (a,b) belonging to R, joining the nodes representing  a-th node and b-th node by an edge as they are visible to each other. Invisible segments are not joined in this manner.

    Path is obtained by searching through this graph.

    Complexity of the algorithm is O(n^4(L +log(n/e))^2/(e^2))
     

    CONCLUSION:
     

  • Visibility graph provide the shortest path
  • Efficient algorithms exist for two dimensional space, but the problem becomes NP-Hard in three dimension.  Moreover, the methods discussed above are not generalizable in R^2 x S.
  • Due to this, this method is not used for high dimensional C-space.

  • REFERENCES:
     

  • Constructing  The Visibility Graph For n-Line segments in  O(n^2) Time, Emo Welzl, Information Processing Letters 20 (1985), Pgs. 167-171
  • An Algorithm for Shortest-Path Motion in Three Dimensions, Christos H. Papadimitriou, Information Processing Letters 20 (1985), Pgs. 259-263
  • Robot Motion Planning, Jean Claude Latombe, Kluwer Academic Publishers, Boston, MA, 1991

  •