model_server/gedge/src/bico.cxx
/*-----------------------------------------------------------------------------------------*
 *  BUILD_UGRAPH trgt die Kanten aus BC_EDGE in den ungerichteten Graphen ein.            *
 *-----------------------------------------------------------------------------------------*/
BUILD_UGRAPH trgt die Kanten aus BC_EDGE in den ungerichteten Graphen ein.
BUILD_UGRAPH trgt die Kanten aus BC_EDGE in den ungerichteten Graphen ein .
void  BUILD_UGRAPH( BICO_COMP *BC, int max )
{
    int         *used;
    int         *inv_table;
    int         i, n;
    BC_EDGE     *E;
    used = (int *) psetmalloc( (max+1) * sizeof( int ) );               
    for ( i = 1; i <= max; i++ ) used[i] = false;
    for ( E = BC->first; E != nil; E = E->next ) {        
        used[ E->source ] = true;
        used[ E->dest   ] = true;
    }
    n = 0;                                                                
    for ( i = 1; i <= max; i++ ) if ( used[i] ) n++;
    BC->n = n;
    n = 0;                                                 
    BC->name_table = (int *) psetmalloc( (BC->n+1) * sizeof( int ) );
    inv_table      = (int *) psetmalloc( (max+1) * sizeof( int ) );
    for ( i = 1; i <= max; i++ ) 
        if ( used[i] ) { 
            n++; 
            BC->name_table[ n ] = i;
            inv_table[ i ] = n;
        }
    BC->UG = CREATE_UGRAPH( BC->n );                     
    for ( i = 1; i <= BC->n; i++ ) SET_UGRAPH_TRANS_NO( BC->UG, i, i );
    for ( E = BC->first; E != nil; E = E->next )               
        SET_UEDGE( BC->UG, inv_table[ E->source ], 
                           inv_table[ E->dest   ] );
}
void BUILD_UGRAPH ( BICO_COMP * BC , int max ) { int * used ; int * inv_table ; int i , n ; BC_EDGE * E ; used = ( int * ) psetmalloc ( ( max + 1 ) * sizeof ( int ) ) ; for ( i = 1 ; i <= max ; i ++ ) used [ i ] = false ; for ( E = BC -> first ; E != nil ; E = E -> next ) { used [ E -> source ] = true ; used [ E -> dest ] = true ; } n = 0 ; for ( i = 1 ; i <= max ; i ++ ) if ( used [ i ] ) n ++ ; BC -> n = n ; n = 0 ; BC -> name_table = ( int * ) psetmalloc ( ( BC -> n + 1 ) * sizeof ( int ) ) ; inv_table = ( int * ) psetmalloc ( ( max + 1 ) * sizeof ( int ) ) ; for ( i = 1 ; i <= max ; i ++ ) if ( used [ i ] ) { n ++ ; BC -> name_table [ n ] = i ; inv_table [ i ] = n ; } BC -> UG = CREATE_UGRAPH ( BC -> n ) ; for ( i = 1 ; i <= BC -> n ; i ++ ) SET_UGRAPH_TRANS_NO ( BC -> UG , i , i ) ; for ( E = BC -> first ; E != nil ; E = E -> next ) SET_UEDGE ( BC -> UG , inv_table [ E -> source ] , inv_table [ E -> dest ] ) ; }
BUILD_UGRAPH trgt die Kanten aus BC_EDGE in den ungerichteten Graphen ein.
BUILD_UGRAPH trgt die Kanten aus BC_EDGE in den ungerichteten Graphen ein .
//if (debug) printf( "    Build UGraph\n" ); /* used initialisieren */ /* Knoten aller Kanten eintragen */ /* Knoten zhlen */ /* Umsetzungstabellen erstellen */ /* Ungerichteten Graphen erzeugen */ /* und die Kanten eintragen */ /* psetfree( used );
       psetfree( inv_table ); */