From a9980135a0e599dda1b1c5a31992261ca1702ca9 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 14 Feb 2012 22:15:49 -0800 Subject: Isomorphism checking code. --- src/misc/vec/vecInt.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) (limited to 'src/misc') diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 39ab2623..72aa1ab6 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -348,6 +348,22 @@ static inline int Vec_IntSize( Vec_Int_t * p ) return p->nSize; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Vec_IntCap( Vec_Int_t * p ) +{ + return p->nCap; +} + /**Function************************************************************* Synopsis [] @@ -453,6 +469,27 @@ static inline void Vec_IntGrow( Vec_Int_t * p, int nCapMin ) p->nCap = nCapMin; } +/**Function************************************************************* + + Synopsis [Resizes the vector to the given capacity.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_IntGrowResize( Vec_Int_t * p, int nCapMin ) +{ + p->nSize = nCapMin; + if ( p->nCap >= nCapMin ) + return; + p->pArray = ABC_REALLOC( int, p->pArray, nCapMin ); + assert( p->pArray ); + p->nCap = nCapMin; +} + /**Function************************************************************* Synopsis [Fills the vector with given number of entries.] @@ -1215,7 +1252,7 @@ static inline Vec_Int_t * Vec_IntTwoMerge( Vec_Int_t * vArr1, Vec_Int_t * vArr2 /**Function************************************************************* - Synopsis [Performs fast mapping for one node.] + Synopsis [] Description [] @@ -1239,6 +1276,32 @@ static inline void Vec_IntSelectSort( int * pArray, int nSize ) } } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_IntSelectSortCost( int * pArray, int nSize, Vec_Int_t * vCosts ) +{ + int temp, i, j, best_i; + for ( i = 0; i < nSize-1; i++ ) + { + best_i = i; + for ( j = i+1; j < nSize; j++ ) + if ( Vec_IntEntry(vCosts, pArray[j]) < Vec_IntEntry(vCosts, pArray[best_i]) ) + best_i = j; + temp = pArray[i]; + pArray[i] = pArray[best_i]; + pArray[best_i] = temp; + } +} + /**Function************************************************************* Synopsis [] @@ -1279,6 +1342,24 @@ static inline int Vec_IntCompareVec( Vec_Int_t * p1, Vec_Int_t * p2 ) return memcmp( Vec_IntArray(p1), Vec_IntArray(p2), sizeof(int)*Vec_IntSize(p1) ); } +/**Function************************************************************* + + Synopsis [Appends the contents of the second vector.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static void Vec_IntAppend( Vec_Int_t * vVec1, Vec_Int_t * vVec2 ) +{ + int Entry, i; + Vec_IntForEachEntry( vVec2, Entry, i ) + Vec_IntPush( vVec1, Entry ); +} + ABC_NAMESPACE_HEADER_END -- cgit v1.2.3