예제 #1
0
int main() {

  igraph_t graph;
  FILE *ifile = fopen("cattr_bool_bug.graphml", "r");

  if (!ifile) {
    printf("Cannot open input file");
    return 1;
  }

  igraph_i_set_attribute_table(&igraph_cattribute_table);

  igraph_read_graph_graphml(&graph, ifile, 0);
  fclose(ifile);

  check_attr(&graph, 10);

  igraph_to_directed(&graph, IGRAPH_TO_DIRECTED_ARBITRARY);

  check_attr(&graph, 20);

  if (GAB(&graph, "loops")) { return 2; }

  igraph_destroy(&graph);

  return 0;
}
예제 #2
0
void testGapArrayByte()
{
	uint64_t const gsize = 329114;
	libmaus2::autoarray::AutoArray<uint32_t> GG(gsize);
	for ( uint64_t i = 0; i < gsize; ++i )
		GG[i] = 1;
	
	for ( uint64_t i = 0; i < 32; ++i )
		GG[libmaus2::random::Random::rand64() % gsize] = 257;
	
	uint64_t const numthreads = 32;
	
	libmaus2::suffixsort::GapArrayByte GAB(gsize,16,numthreads,"tmp");

	#if defined(_OPENMP)
	#pragma omp parallel for num_threads(numthreads)
	#endif
	for ( uint64_t i = 0; i < gsize; ++i )
		for ( uint64_t j = 0; j < GG[i]; ++j )
			if ( GAB(i) )
				#if defined(_OPENMP)
				GAB(i,omp_get_thread_num());
				#else
				GAB(i,0);				
				#endif

	GAB.flush();
	
	uint64_t offset = 0;
	libmaus2::suffixsort::GapArrayByteDecoder::unique_ptr_type pdec(GAB.getDecoder(offset));
	libmaus2::autoarray::AutoArray<uint32_t> TT(48);
	
	while ( offset != gsize )
	{
		uint64_t const rest = gsize - offset;
		uint64_t const tocopy = std::min(rest,TT.size());
		pdec->decode(TT.begin(),tocopy);
		
		for ( uint64_t i = 0; i < tocopy; ++i )
			assert (
				TT[i] == GG[offset+i]
			);
		
		offset += tocopy;
	}
}