~gabor.csardi/igraph/develop

« back to all changes in this revision

Viewing changes to src/igraph_hrg.cc

  • Committer: Gabor Csardi
  • Date: 2013-11-14 15:32:41 UTC
  • Revision ID: git-v1:50150d16791efe51abda9b3343e6beb69fd3cf99
Implement the 'start' argument in igraph_hrg_fit (#225).

Show diffs side-by-side

added added

removed removed

Lines of Context:
354
354
  int no_of_nodes=igraph_vcount(graph);
355
355
  dendro *d;
356
356
 
357
 
  IGRAPH_CHECK(igraph_hrg_resize(hrg, no_of_nodes));
358
 
 
359
357
  RNG_BEGIN();
360
358
 
361
359
  d = new dendro;  
363
361
  // Convert the igraph graph
364
362
  IGRAPH_CHECK(igraph_i_hrg_getgraph(graph, d));
365
363
 
 
364
  // If we want to start from HRG
 
365
  if (start) {
 
366
    if (igraph_hrg_size(hrg) != no_of_nodes) {
 
367
      IGRAPH_ERROR("Invalid HRG to start from", IGRAPH_EINVAL);
 
368
    }
 
369
    d->importDendrogramStructure(hrg);
 
370
  } else {
 
371
    IGRAPH_CHECK(igraph_hrg_resize(hrg, no_of_nodes));
 
372
  }
 
373
 
366
374
  // Run fixed number of steps, or until convergence
367
375
  if (steps > 0) {
368
376
    IGRAPH_CHECK(markovChainMonteCarlo(d, steps, hrg));