void *_K33Search_DupContext(void *pContext, void *theGraph) { K33SearchContext *context = (K33SearchContext *) pContext; K33SearchContext *newContext = (K33SearchContext *) malloc(sizeof(K33SearchContext)); if (newContext != NULL) { int N = ((graphP) theGraph)->N; int Gsize = ((graphP) theGraph)->edgeOffset + ((graphP) theGraph)->arcCapacity; *newContext = *context; newContext->theGraph = (graphP) theGraph; newContext->initialized = 0; _K33Search_ClearStructures(newContext); if (N > 0) { if (_K33Search_CreateStructures(newContext) != OK) { _K33Search_FreeContext(newContext); return NULL; } LCCopy(newContext->sortedDFSChildLists, context->sortedDFSChildLists); memcpy(newContext->G, context->G, Gsize*sizeof(K33Search_GraphNode)); memcpy(newContext->V, context->V, N*sizeof(K33Search_VertexRec)); } } return newContext; }
void *_K33Search_DupContext(void *pContext, void *theGraph) { K33SearchContext *context = (K33SearchContext *) pContext; K33SearchContext *newContext = (K33SearchContext *) malloc(sizeof(K33SearchContext)); if (newContext != NULL) { int VIsize = gp_PrimaryVertexIndexBound((graphP) theGraph); int Esize = gp_EdgeIndexBound((graphP) theGraph); *newContext = *context; newContext->theGraph = (graphP) theGraph; newContext->initialized = 0; _K33Search_ClearStructures(newContext); if (((graphP) theGraph)->N > 0) { if (_K33Search_CreateStructures(newContext) != OK) { _K33Search_FreeContext(newContext); return NULL; } memcpy(newContext->E, context->E, Esize*sizeof(K33Search_EdgeRec)); memcpy(newContext->VI, context->VI, VIsize*sizeof(K33Search_VertexInfo)); LCCopy(newContext->separatedDFSChildLists, context->separatedDFSChildLists); } } return newContext; }
void *_ColorVertices_DupContext(void *pContext, void *theGraph) { ColorVerticesContext *context = (ColorVerticesContext *) pContext; ColorVerticesContext *newContext = (ColorVerticesContext *) malloc(sizeof(ColorVerticesContext)); if (newContext != NULL) { int I, N = ((graphP) theGraph)->N; //int Gsize = ((graphP) theGraph)->edgeOffset + ((graphP) theGraph)->arcCapacity; *newContext = *context; newContext->theGraph = (graphP) theGraph; newContext->initialized = 0; _ColorVertices_ClearStructures(newContext); if (N > 0) { if (_ColorVertices_CreateStructures(newContext) != OK) { _ColorVertices_FreeContext(newContext); return NULL; } // Initialize custom data structures by copying LCCopy(newContext->degLists, context->degLists); for (I=0; I<N; I++) { newContext->degListHeads[I] = context->degListHeads[I]; newContext->degree[I] = context->degree[I]; newContext->color[I] = context->color[I]; } newContext->numVerticesToReduce = context->numVerticesToReduce; newContext->highestColorUsed = context->highestColorUsed; newContext->colorDetector = NULL; } } return newContext; }