//_________________________________________________________________________
void graph_molloy_hash::depth_isolated(int v, long &calls, int &left_to_explore, int dmax, int * &Kbuff, bool *visited) {
  if(left_to_explore==0) return;
//  if(yapido) fprintf(stderr,"%d ",deg[v]);
  if(--left_to_explore == 0) return;
  if(deg[v]+1>=dmax) {
    left_to_explore = 0;
    return;
  }
  *(Kbuff++) = v;
  visited[v] = true;
//  print();
//  fflush(stdout);
  calls++;
  int *copy = NULL;
  int *w = neigh[v];
  if(IS_HASH(deg[v])) {
    copy = new int[deg[v]];
    H_copy(copy,w,deg[v]);
    w = copy;
  }
  qsort(deg, w, deg[v]);
  w+=deg[v];
  for(int i=deg[v]; i--; ) {
    if(visited[*--w]) calls++;
    else depth_isolated(*w, calls, left_to_explore, dmax, Kbuff, visited);
    if(left_to_explore==0) break;
  }
  if(copy!=NULL) delete[] copy;
}
Example #2
0
BOOST_AUTO_TEST_CASE_TEMPLATE(copy, T, float_types) {
	vmath::core::Quaternion<T> H;
	H.x = static_cast<T>(20.12);
	H.y = static_cast<T>(100.89);
	H.z = static_cast<T>(-18.2);
	H.w = static_cast<T>(35.63);
	vmath::core::Quaternion<T> H_copy(H);
	BOOST_CHECK_CLOSE(H_copy.x, H.x, 1e-4f);
	BOOST_CHECK_CLOSE(H_copy.y, H.y, 1e-4f);
	BOOST_CHECK_CLOSE(H_copy.z, H.z, 1e-4f);
	BOOST_CHECK_CLOSE(H_copy.w, H.w, 1e-4f);
}