 		// Iterate over the neighbors and check if the coloring is valid	
 		for (int CurrNodeOffset=d_RowPtr[threadID]; CurrNodeOffset<d_RowPtr[threadID+1] ; CurrNodeOffset++){
 			int NeighborColor = d_ColorVector[d_ColIdx[CurrNodeOffset]];
-			if (NeighborColor == d_ColorVector[threadID]){
+			if ((NeighborColor == d_ColorVector[threadID]) && (threadID<d_ColIdx[CurrNodeOffset])){
 				// If the color matches with any one neighbor
 				// its not valid, and we must recolor
 				ColorValid=false;


// Init the ColorValid array
// TODO: Replace with one thrust::fill call
__global__ void InitializeColorVector(int d_NumVertices, bool* d_ColorValid){
	int threadID = blockIdx.x * blockDim.x + threadIdx.x;
	if (threadID < d_NumVertices){
		d_ColorValid[threadID] = false;	
	}
}


			for (int CurrNodeOffset=d_RowPtr[threadID]; CurrNodeOffset<d_RowPtr[threadID+1] ; CurrNodeOffset++){
				// Mark the neighbor's colors unavailable by
				// pushing them into the NeighborColors vector
				int NodeIndex = d_ColIdx[CurrNodeOffset];
				int NodeColor = d_ColorVector[NodeIndex];
				NeighborColors[NumNeighbors++] = NodeColor;
			}
			// Here, we have the neighbor's colors
