8.4 Maintaining the Reduced Graph

With the vertex elimination data structure established, maintenance and query operations are straightforward. Algorithm 18 implements increase_degree. It assumes the list communication buffer is x x .

Algorithm 18: Increase the Degree of a Vertex
increase_degree( v v )
    n = n= evaluate( λ , v \lambda,v ) + 1 +1
   map( λ , v , n \lambda,v,n )
    i = k = i=k= find( L , v L,v )
   while  k e o l k\neq eol  and  n > n> evaluate( λ , k \lambda,k )
       k = n k=n ext( L , k L,k )
   link( L , k , v L,k,v )
   unlink( L , i L,i )

In words, Algorithm 18 increases the degree of v v and scans the degree list L L in ascending order until the new position of v v is located. It then adds v v into L L at this position and deletes v v from the old position. In the worst case, the loop in Algorithm 18 is an O V O\left(|V^{{\prime}}|\right) operation. This degenerate case only occurs when all vertices in V G V^{{\prime}}(G^{{\prime}}) have the same degree and v v is the first item in L L .

Algorithm 19: Decrease the Degree of a Vertex
decrease_degree( v v )
    n = n= evaluate( λ , v \lambda,v ) - 1 -1
   map( λ , v , n \lambda,v,n )
    i = k = i=k= find( L , v L,v )
   while  k e o l k\neq eol  and  n < n< evaluate( λ , k \lambda,k )
       k = k= previous( L , k L,k )
   link( L , k , v L,k,v )
   unlink( L , i L,i )

Algorithm 19 implements the decrease_degree operation. It decreases the degree of v v then scans the degree list L L in descending order until the new position of v v is located. It then adds v v into L L at this position and deletes v v from the old position. Once again, Algorithm 19 is an O V O\left(|V^{{\prime}}|\right) in the worse case. In the average case, it is much closer O 1 O(1) .

The remove operator (Algorithm 20) excises v v from the degree list L L and makes sure its degree count is less than or equal to zero in the mapping λ \lambda .

Algorithm 20: Remove a Vertex from the Reduced Graph
remove( v v )
    i = i= find( L , v L,v )
   unlink( L , i L,i )
   map( λ , v , 0 \lambda,v,0 )