File: SymmetricBFS.cc

package info (click to toggle)
topcom 0.17.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 78,572 kB
  • sloc: cpp: 16,640; sh: 975; makefile: 345; ansic: 40
file content (682 lines) | stat: -rw-r--r-- 22,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
////////////////////////////////////////////////////////////////////////////////
// 
// SymmetricBFS.cc
//
//    produced: 24/07/98 jr
// last change: 24/07/98 jr
// 
////////////////////////////////////////////////////////////////////////////////

#include <sstream>

#include "SymmetricBFS.hh"

void SymmetricBFS::_mark_equivalent_flips(const TriangNode&                     tnode, 
					  const tnode_container_type::iterator  find_iter,
					  const FlipRep&                        fliprep) {
#ifdef CHECK_MARK
  std::cerr << "flip before marking:" << std::endl;
  std::cerr << find_iter->key() << "->" << find_iter->data() << std::endl;
#endif
  // mark this flip:
#ifndef STL_CONTAINERS
  find_iter->dataptr()->mark_flip(fliprep);
#else
  find_iter->second.mark_flip(fliprep);
#endif
  // mark all equivalent flips:
  for (SymmetryGroup::const_iterator iter = _node_symmetries.begin();
       iter != _node_symmetries.end();
       ++iter) {
    const Symmetry& g = *iter;
#ifndef STL_CONTAINERS
    find_iter->dataptr()->mark_flip(g(fliprep));
#else
    find_iter->second.mark_flip(g(fliprep));
#endif
  }
#ifdef CHECK_MARK
  std::cerr << "flip after marking:" << std::endl;
  std::cerr << find_iter->key() << "->" << find_iter->data() << std::endl;
#endif
}

void SymmetricBFS::_mark_equivalent_flips(const TriangNode& tnode, 
					  TriangFlips&      tflips,
					  const FlipRep&    fliprep) {
#ifdef CHECK_MARK
  std::cerr << "flips before marking:" << std::endl;
  std::cerr << tflips << std::endl;
#endif
  // mark this flip:
  tflips.mark_flip(fliprep);
  // mark all equivalent flips:
  for (SymmetryGroup::const_iterator iter = _node_symmetries.begin();
       iter != _node_symmetries.end();
       ++iter) {
#ifndef STL_SYMMETRIES
    const Symmetry& g(iter->key());
#else
    const Symmetry& g(*iter);
#endif
    tflips.mark_flip(g(fliprep));
  }
#ifdef CHECK_MARK
  std::cerr << "flips after marking:" << std::endl;
  std::cerr << tflips << std::endl;
#endif
}

const int SymmetricBFS::_old_symmetry_class(const TriangNode& tnode) {
  if (CommandlineOptions::simple()) {
#ifndef STL_CONTAINERS
    if (_all_triangs.member(tnode)) {
#else
    if (_all_triangs.find(tnode) != _all_triangs.end()) {
#endif
      _orbitsize = 0;
      return -1;
    }

    // first check whether tnode represents an old symmetry class:
    for (SymmetryGroup::const_iterator iter = _symmetries.begin();
	 iter != _symmetries.end();
	 ++iter) {
#ifndef STL_SYMMETRIES
      const Symmetry& g(iter->key());
#else
      const Symmetry& g(*iter);
#endif
      _representative = g(tnode);

      triang_container_type::const_iterator t_iter = _all_triangs.find(_representative);
// #ifndef STL_CONTAINERS
//       if (!_orbit.member(_representative)) {
// 	if (_all_triangs.member(_representative)) {
// #else
      if (_orbit.find(_representative) == _orbit.end()) {
	if (t_iter != _all_triangs.end()) {
// #endif	  
	  _orbit.clear();
	  _orbitsize = 0;
	  return 1;
	}
      }
    }

    // next, check for the search predicate (e.g., regularity) for tnode:
    if ((*_search_pred_ptr)(*_pointsptr, *_chiroptr, tnode)) {
      
      // tnode has search predicate:
      _rep_has_search_pred = true;
      _orbit.insert(tnode);
    }
    else {
      _rep_has_search_pred = false;
      if (CommandlineOptions::symmetries_are_affine()) {

	// tnode's complete orbit does not have search predicate:
	_orbitsize = 0;
	return 0; // what we return does not matter anymore because _orbitsize is zero
      }
    }

    // now check the orbit of tnode for the search predicate (e.g., regularity):
    for (SymmetryGroup::const_iterator iter = _symmetries.begin();
	 iter != _symmetries.end();
	 ++iter) {
#ifndef STL_SYMMETRIES
      const Symmetry& g(iter->key());
#else
      const Symmetry& g(*iter);
#endif
      _representative = g(tnode);

#ifndef STL_CONTAINERS
      if (!_orbit.member(_representative)) {
#else
	if (_orbit.find(_representative) == _orbit.end()) {
#endif
	if (_rep_has_search_pred && CommandlineOptions::symmetries_are_affine()) {
	  _orbit.insert(_representative);
	}
	else {
	  if ((*_search_pred_ptr)(*_pointsptr, *_chiroptr, _representative)) {
	    _orbit.insert(_representative);
	  }
	}
      }
    }
  }
  else {

    // handle the identity individually:
    if ((_find_iter = _previous_triangs.find(tnode)) != _previous_triangs.end()) {
      _orbitsize = 0;
      return -1;
    }
    if ((_find_iter = _new_triangs.find(tnode)) != _new_triangs.end()) {
      _orbitsize = 0;
      return -2;
    }

    // first check whether we already found an equivalent triangluation:
    for (SymmetryGroup::const_iterator iter = _symmetries.begin();
	 iter != _symmetries.end();
	 ++iter) {
#ifndef STL_SYMMETRIES
      const Symmetry& g(iter->key());
#else
      const Symmetry& g(*iter);
#endif
      _representative = g(tnode);
#ifndef STL_CONTAINERS
      if (!_orbit.member(_representative)) {      
#else
      if (_orbit.find(_representative) == _orbit.end()) {
#endif
	if ((_find_iter = _previous_triangs.find(_representative)) != _previous_triangs.end()) {
#ifndef STL_SYMMETRIES
	  _transformation = iter->key();
#else
	  _transformation = *iter;
#endif
	  _orbit.clear();
	  _orbitsize = 0;
	  return 1;
	}
	if ((_find_iter = _new_triangs.find(_representative)) != _new_triangs.end()) {
#ifndef STL_SYMMETRIES
	  _transformation = iter->key();
#else
	  _transformation = *iter;
#endif
	  _orbit.clear();
	  _orbitsize = 0;
	  return 2;
	}
      }
    }
    
    // now check the search predicate (e.g., regularity, for the 
    // discovered representative tnode of the new sysmmetry class:
    if ((*_search_pred_ptr)(*_pointsptr, *_chiroptr, tnode)) {
      
      // tnode has search predicate:
      _rep_has_search_pred = true;
      _orbit.insert(tnode);
    }
    else {
      _rep_has_search_pred = false;
      if (CommandlineOptions::symmetries_are_affine()) {
	
	// tnode's complete orbit does not have search predicate:
	_orbitsize = 0;
	return 0; // what we return does not matter anymore because _orbitsize is zero
      }
    }

    // next, we need to check the orbit of tnode for the search predicate (e.g., regularity):
    for (SymmetryGroup::const_iterator iter = _symmetries.begin();
	 iter != _symmetries.end();
	 ++iter) {
#ifndef STL_SYMMETRIES
      const Symmetry& g(iter->key());
#else
      const Symmetry& g(*iter);
#endif
      _representative = g(tnode);

      // check whether we already have that image of tnode in the orbit:
#ifndef STL_CONTAINERS
      if (!_orbit.member(_representative)) {
#else
      if (_orbit.find(_representative) == _orbit.end()) {
#endif

	// if not, check the search predicate (e.g., regularity):
	if (_rep_has_search_pred && CommandlineOptions::symmetries_are_affine()) {

	  // in this case, no check required because symmetries do not change 
          // the search predicate:
	  _orbit.insert(_representative);
	}
	else {

	  // here we need to check the orbit element directly:
	  if ((*_search_pred_ptr)(*_pointsptr, *_chiroptr, _representative)) {
	    _orbit.insert(_representative);
	  }
	}
      }
    }
  }
#ifndef STL_CONTAINERS
  _orbitsize = _orbit.load();
#else
  _orbitsize = _orbit.size();
#endif
  _orbit.clear();
  return 0;
}

void SymmetricBFS::_process_newtriang(const TriangNode&     current_triang,
				      const TriangFlips&    current_flips,
				      const TriangNode&     next_triang,
				      const FlipRep&        current_fliprep) {
  const int where(_old_symmetry_class(next_triang));
  if (CommandlineOptions::simple()) {
    if (where != 0) {
      return;
    }
    if (_orbitsize > 0) {
      if ((*_output_pred_ptr)(*_pointsptr, *_chiroptr, next_triang)) {
	++_symcount;
	--_reportcount;
	_totalcount += _orbitsize;
	(*_cout_triang_ptr)(_symcount, next_triang);
	if (CommandlineOptions::verbose() && (_reportcount == 0)) {
	  _reportcount = CommandlineOptions::report_frequency();
	  std::cerr << _symcount << " symmetry classes --- "
		    << _totalcount << " total triangulations --- "
#ifndef STL_CONTAINERS
 		    << _all_triangs.load() + _new_triangs.load() << " stored." << std::endl;
#else
		    << _all_triangs.size() + _new_triangs.size() << " stored." << std::endl;
#endif
	}
      }
      TriangFlips next_flips;
      _new_triangs[next_triang] = next_flips;
      _all_triangs.insert(next_triang);
    }
  }
  else {
    if (where < 0) {

      // next_triang was found before: mark all equivalent flips in next_triang:
      const FlipRep& inversefliprep(current_fliprep.inverse());
      _node_symmetries = SymmetryGroup(_symmetries, next_triang);
      _mark_equivalent_flips(next_triang, _find_iter, inversefliprep);
      if (CommandlineOptions::output_flips()) {
	// output flip to found triangulation pointed to by _find_iter:
#ifndef STL_CONTAINERS
	size_type next_ID(_find_iter->key().ID());
#else
	size_type next_ID(_find_iter->first.ID());
#endif
	std::cout << "flip[" 
		  << _flipcount << "]:=" 
		  << '{' 
		  << current_triang.ID() 
		  << ',' 
		  << next_ID
		  << "};" 
		  << " // to known triang, supported by "
		  << current_fliprep
		  << std::endl;
	++_flipcount;
      }
      return;
    }
    if (where > 0) {

      // a triangulation equivalent to next_triang was found before: mark all equivalent flips in representative:
      const FlipRep& inversefliprep(_transformation(current_fliprep.inverse()));
      _node_symmetries = SymmetryGroup(_symmetries, _representative);
      _mark_equivalent_flips(_representative, _find_iter, inversefliprep);
      return;
    }
    if (_orbitsize > 0) {

      // we found at least one new triangulation in orbit satisfying 
      // the search predicate; thus we must save the representative
      _node_symmetries = SymmetryGroup(_symmetries, next_triang);
      TriangFlips next_flips = TriangFlips(*_chiroptr,
					   current_triang, 
					   current_flips, 
					   next_triang, 
					   Flip(current_triang, current_fliprep),
					   _symmetries,
					   _node_symmetries,
					   _only_fine_triangs);
      _mark_equivalent_flips(next_triang, next_flips, current_fliprep.inverse());
      if (CommandlineOptions::output_flips()) {
	// output flip to next_triang:
	std::cout << "flip[" 
		  << _flipcount << "]:=" 
		  << '{' 
		  << current_triang.ID() 
		  << ',' 
		  << next_triang.ID() 
		  << "};" 
		  << " // supported by "
		  << current_fliprep
		  << std::endl;
	++_flipcount;
      }
      if ((*_output_pred_ptr)(*_pointsptr, *_chiroptr, next_triang)) {
	++_symcount;
	--_reportcount;
	_totalcount += _orbitsize;
	(*_cout_triang_ptr)(_symcount, next_triang);
	if (CommandlineOptions::verbose() && (_reportcount == 0)) {
	  _reportcount = CommandlineOptions::report_frequency();
	  std::cerr << _symcount << " symmetry classes --- "
		    << _totalcount << " total triangulations --- "
#ifndef STL_CONTAINERS
 		    << _previous_triangs.load() + _new_triangs.load() 
#else
		    << _previous_triangs.size() + _new_triangs.size() 
#endif
		    << " currently stored." << std::endl;
	}
      }
#ifdef CHECK_NEW
      if (all_triangs.find(next_triang) != all_triangs.end()) {
	std::cerr << "Error in SymmetricBFS: old triangulation:" << std::endl;
	std::cerr << next_triang << std::endl;
	std::cerr << "reinserted into" << std::endl;
	std::cerr << all_triangs << std::endl;
	std::cerr << "current new triangs:" << std::endl;
	std::cerr << _new_triangs << std::endl;
	std::cerr << "current previous triangs:" << std::endl;
	std::cerr << _previous_triangs << std::endl;
	exit(1);
      }
#endif
#ifdef SUPER_VERBOSE
      std::cerr << next_triang << " is new." << std::endl;
#endif
      _new_triangs[next_triang] = next_flips;
    }
  }
}

void SymmetricBFS::_process_flips(const TriangNode&     current_triang,
				  const TriangFlips&    current_flips) {
#ifdef SUPER_VERBOSE
  std::cerr << "current_triang" << std::endl;
  std::cerr << current_triang << std::endl;
  std::cerr << "current_flips" << std::endl;
  std::cerr << current_flips << std::endl;
#endif
  for (MarkedFlips::const_iterator iter = current_flips.flips().begin();
       iter !=current_flips.flips().end(); 
       ++iter) {
#ifndef STL_FLIPS
    if (iter->data()) {
#else
    if ((*iter).second) {
#endif
      continue;
    }
#ifdef SUPER_VERBOSE
    std::cerr << "flipping flip " << iter->key() 
	      << " = " << Flip(current_triang, iter->key()) << std::endl;
#endif
#ifndef STL_FLIPS
    const FlipRep current_fliprep(iter->key());
#else
    const FlipRep current_fliprep((*iter).first);
#endif
    const Flip flip(current_triang, current_fliprep);
    const TriangNode next_triang(_symcount, current_triang, flip);
    _process_newtriang(current_triang, current_flips, next_triang, current_fliprep);
  }
}

void SymmetricBFS::_bfs_step() {
  // go through all triangulations found so far:
#ifndef STL_CONTAINERS
  while (!_previous_triangs.is_empty()) {
#else
  while (!_previous_triangs.empty()) {
#endif
    tnode_container_type::const_iterator iter(_previous_triangs.begin());
#ifndef STL_CONTAINERS
    const TriangNode current_triang(iter->key());
#else
    const TriangNode current_triang(iter->first);
#endif
    if (CommandlineOptions::simple()) {
      const TriangFlips current_flips(*_chiroptr, current_triang, _symmetries, _only_fine_triangs);
      _process_flips(current_triang, current_flips);
    }
    else {
#ifndef STL_CONTAINERS
      const TriangFlips current_flips(iter->data());
#else
      const TriangFlips current_flips(iter->second);
#endif
      _process_flips(current_triang, current_flips);
    }
    _previous_triangs.erase(current_triang);
  }
#ifdef CHECK_NEW
  for (tnode_container_type::const_iterator iter = _new_triangs.begin();
       iter != _new_triangs.end();
       ++iter) {
#ifndef STL_CONTAINERS
    all_triangs[iter->key()] = iter->data();
#else
    all_triangs[iter->first] = iter->second;
#endif
  }
#endif
  if (CommandlineOptions::verbose()) {
#ifndef STL_CONTAINERS
    std::cerr << _new_triangs.load() << " new symmetry classes." << std::endl;
#else
    std::cerr << _new_triangs.size() << " new symmetry classes." << std::endl;
#endif
#ifdef WATCH_MAXCHAINLEN
    std::cerr << "length of maximal chain in hash table _new_triangs: " 
	 << _new_triangs.maxchainlen() << std::endl;
#endif
  }
}

void SymmetricBFS::_bfs() {
#ifndef STL_CONTAINERS
  while (!_previous_triangs.is_empty()) {
#else
  while (!_previous_triangs.empty()) {
#endif
    _bfs_step();
#ifndef STL_CONTAINERS
    tnode_container_type tmp;
    _previous_triangs = _new_triangs;
    _new_triangs = tmp;
#else
    _previous_triangs.swap(_new_triangs);
#endif
 
    // dump status if requested:
    if (CommandlineOptions::dump_status()) {
      if  (this->_processed_count % CommandlineOptions::dump_frequency() == 0) {
	std::ostringstream filename_str;
	filename_str << CommandlineOptions::dump_file() << "." << _dump_no % CommandlineOptions::dump_rotations();
	_dump_str.open(filename_str.str().c_str(), std::ios::out | std::ios::trunc);
	write(_dump_str);
	_dump_str.close();
	++_dump_no;
	_processed_count = 0;
      }
      ++_processed_count;
    }
  }
}

// stream input:

std::istream& SymmetricBFS::read(std::istream& ist) {
  std::string dump_line;

  while ((std::getline(ist, dump_line))) {
    std::string::size_type lastPos = dump_line.find_first_not_of(" ", 0);
    std::string::size_type pos     = dump_line.find_first_of(" ", lastPos);
    std::string keyword            = dump_line.substr(lastPos, pos - lastPos);

    // first, some data is parsed that makes sure that the dumped computational results were
    // obtained with the "right" data:
    if (keyword == "_no") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      parameter_type no_check;
      
      if (!(istrst >> no_check)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _no; exiting" << std::endl;
	exit(1);
      }
      if (_no != no_check) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): no of points in input differs from no of points in dump file; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "no of points in input coincides with no of points in dump file: okay" << std::endl;
      }
    }
    if (keyword == "_rank") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      parameter_type rank_check;

      if (!(istrst >> rank_check)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _rank; exiting" << std::endl;
	exit(1);
      }
      if (_rank != rank_check) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): rank of input differs from rank in dump file; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "rank of input coincides with rank of dump file: okay" << std::endl;
      }
    }
    if (_pointsptr) {
      if (keyword == "_points") {
	lastPos = dump_line.find_first_not_of(" ", pos);
	std::string value = dump_line.substr(lastPos, dump_line.length());
	std::istringstream istrst (value, std::ios::in);
	PointConfiguration points_check;
	
	if (!(istrst >> points_check)) {
	  std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _points; exiting" << std::endl;
	  exit(1);
	}
	if (*_pointsptr!= points_check) {
	  std::cerr << "SymmetricBFS::read(std::istream& ist): points of input differ from points in dump file; exiting" << std::endl;
	  exit(1);
	}
	if (CommandlineOptions::debug()) {
	  std::cerr << "points of input coincide with points in dump file: okay" << std::endl;
	}
      }
    }
    if (_chiroptr) {
      if (keyword == "_chiro") {
	lastPos = dump_line.find_first_not_of(" ", pos);
	std::string value = dump_line.substr(lastPos, dump_line.length());
	std::istringstream istrst (value, std::ios::in);
	Chirotope chiro_check;
	
	if (!(istrst >> chiro_check)) {
	  std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _chiro; exiting" << std::endl;
	  exit(1);
	}
	if ((*_chiroptr) != chiro_check) {
	  std::cerr << "SymmetricBFS::read(std::istream& ist): chirotope of input differs from chirotope in dump file; exiting" << std::endl;
	  exit(1);
	}
	if (CommandlineOptions::debug()) {
	  std::cerr << "chirotope of input coincides with chirotope of dump file: okay" << std::endl;
	}
      }
    }
    if (keyword == "_symmetries") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      SymmetryGroup symmetries_check(_no);
      
      if (!(istrst >> symmetries_check)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _symmetries; exiting" << std::endl;
	exit(1);
      }
      if (_symmetries != symmetries_check) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): symmetries of input differ from symmetries in dump file; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "symmetries of input coincide with _symmetries in dump file: okay" << std::endl;
      }
    }
    // finally, parse the partial computational result from the dump file:
    if (keyword == "_previous_triangs") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      if (!(istrst >> _previous_triangs)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _previous_triangs; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "_previous_triangs initialized with " << _previous_triangs << std::endl;
      }
    }
    if (keyword == "_new_triangs") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      if (!(istrst >> _new_triangs)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _previous_triangs; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "_new_triangs initialized with " << _new_triangs << std::endl;
      }
    }
    if (keyword == "_totalcount") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());      
      std::istringstream istrst (value, std::ios::in);      
      if (!(istrst >> _totalcount)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _totalcount; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "_totalcount initialized with " << _totalcount << std::endl;
      }
    }
    if (keyword == "_symcount") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      if (!(istrst >> _symcount)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _symcount; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "_symcount initialized with " << _symcount << std::endl;
      }
    }
    if (keyword == "_reportcount") {
      lastPos = dump_line.find_first_not_of(" ", pos);
      std::string value = dump_line.substr(lastPos, dump_line.length());
      std::istringstream istrst (value, std::ios::in);
      if (!(istrst >> _reportcount)) {
	std::cerr << "SymmetricBFS::read(std::istream& ist): error while reading _reportcount; exiting" << std::endl;
	exit(1);
      }
      if (CommandlineOptions::debug()) {
	std::cerr << "_reportcount initialized with " << _reportcount << std::endl;
      }
    }
  }
  return ist;
}

// eof SymmetricBFS.cc