File: graph.h

package info (click to toggle)
regina-normal 7.4.1-1.1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 154,244 kB
  • sloc: cpp: 295,026; xml: 9,992; sh: 1,344; python: 1,225; perl: 616; ansic: 138; makefile: 26
file content (1254 lines) | stat: -rw-r--r-- 51,597 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
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254

/**************************************************************************
 *                                                                        *
 *  Regina - A Normal Surface Theory Calculator                           *
 *  Computational Engine                                                  *
 *                                                                        *
 *  Copyright (c) 1999-2025, Ben Burton                                   *
 *  For further details contact Ben Burton (bab@debian.org).              *
 *                                                                        *
 *  This program is free software; you can redistribute it and/or         *
 *  modify it under the terms of the GNU General Public License as        *
 *  published by the Free Software Foundation; either version 2 of the    *
 *  License, or (at your option) any later version.                       *
 *                                                                        *
 *  As an exception, when this program is distributed through (i) the     *
 *  App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or     *
 *  (iii) Google Play by Google Inc., then that store may impose any      *
 *  digital rights management, device limits and/or redistribution        *
 *  restrictions that are required by its terms of service.               *
 *                                                                        *
 *  This program is distributed in the hope that it will be useful, but   *
 *  WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *  General Public License for more details.                              *
 *                                                                        *
 *  You should have received a copy of the GNU General Public License     *
 *  along with this program. If not, see <https://www.gnu.org/licenses/>. *
 *                                                                        *
 **************************************************************************/

/*! \file triangulation/graph.h
 *  \brief Provides an interface for using triangulations with the
 *  Boost Graph Library (but see the warning below).
 *
 *  \warning Regina does not use this interface itself, and the developers do
 *  not actively test it (since Regina no longer requires Boost at build time).
 *  If you encounter any problems with it then please let the Regina
 *  developers know.
 */

#ifndef __REGINA_TRIANGULATION_GRAPH_H
#ifndef __DOXYGEN
#define __REGINA_TRIANGULATION_GRAPH_H
#endif

#include <iostream>
#include <triangulation/generic.h>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>

namespace regina {

/**
 * Provides an interface for various types of objects from Regina
 * to work directly with the Boost Graph Library (BGL).
 *
 * See the \ref bgl "Boost Graph Library interface page" for details.
 */
namespace graph {

    /**
     * A lightweight object that denotes an oriented edge of the
     * dual graph of a <i>dim</i>-dimensional triangulation.
     *
     * Although the underlying graph is undirected, some concepts from the
     * Boost Graph Library (e.g., the source() and target() functions
     * for a bidirectional graph) require that edges come with an orientation.
     *
     * As a result, the same dual edge may appear with different
     * orientations depending upon how it was obtained.  For example,
     * when iterating through incident edges to a vertex using in_edges() or
     * out_edges(), the same dual edge will appear with opposite orientations
     * depending upon which of its endpoints was used for the iteration.
     *
     * These objects are small enough to pass by value and swap with
     * std::swap(), with no need for any specialised move operations or
     * swap functions.
     *
     * \warning If the underlying triangulation changes, then all DualEdge
     * and DualEdgeIterator objects will become invalid.
     *
     * \tparam dim the dimension of the underlying triangulation.
     */
    template <int dim>
    struct DualEdge {
        Face<dim, dim-1> const* face;
            /**< The (<i>dim</i>-1)-face of the underlying
                triangulation that this edge is dual to. */
        bool forward;
            /**< A dual edge joins two <i>dim</i>-simplices:
                 `face->embedding(0).simplex()` and
                 `face->embedding(1).simplex()`.
                 This data member \a forward is \c true if the dual
                 edge is directed from the first simplex to the second,
                 or \c false if the dual edge is directed from the
                 second simplex back to the first. */

        /**
         * Creates a new object denoting a dual edge.
         *
         * \param face_ the (<i>dim</i>-1)-face of the
         * underlying triangulation to which the edge is dual.
         * \param forward_ indicates how the dual edge is directed, as
         * explained in the \a forward data member docuemntation.
         */
        DualEdge(const Face<dim, dim-1>* face_ = nullptr, bool forward_ = true);

        /**
         * Creates a new copy of the given dual edge object.
         */
        DualEdge(const DualEdge&) = default;
        /**
         * Sets this to be a copy of the given dual edge object.
         *
         * \return a reference to this object.
         */
        DualEdge& operator = (const DualEdge&) = default;

        /**
         * Determines whether this and the given dual edge object
         * are equal.
         *
         * Two dual edge objects are considered equal if and only
         * if: (i) they are dual to the same (<i>dim</i>-1)-face of
         * the triangulation; and (ii) they are directed in the
         * same way.
         *
         * In particular, two parallel edges that are dual to
         * different (<i>dim</i>-1)-faces are considered unequal.
         * Likewise, edges that are dual to the same
         * (<i>dim</i>-1)-face but oriented in opposite
         * directions are also considered unequal.
         *
         * \return \c true if and only if the two dual edges are
         * equal, as described above.
         */
        bool operator == (const DualEdge&) const = default;

        /**
         * Returns the dual vertex at the beginning of this
         * directed dual edge.
         *
         * A directed dual edge begins at source() and ends at
         * target().
         *
         * Note that a dual vertex corresponds to a top-dimensional
         * simplex of the underlying triangulation.
         *
         * \return the top-dimensional simplex corresponding to
         * the dual vertex at the beginning of this dual edge.
         */
        Simplex<dim>* source() const;

        /**
         * Returns the dual vertex at the end of this
         * directed dual edge.
         *
         * A directed dual edge begins at source() and ends at
         * target().
         *
         * Note that a dual vertex corresponds to a top-dimensional
         * simplex of the underlying triangulation.
         *
         * \return the top-dimensional simplex corresponding to
         * the dual vertex at the end of this dual edge.
         */
        Simplex<dim>* target() const;
    };

    /**
     * Used to iterate through all dual edges of a
     * <i>dim</i>-dimensional triangulation.
     *
     * Each dual edge is dual to some (<i>dim</i>-1)-face of the
     * underlying triangulation, and the order of iteration will follow
     * the indexing of (<i>dim</i>-1)-faces within the triangulation.
     * Note however that the range of dual edge iterators may be
     * smaller, since a dual edge iterator will skip over those
     * (<i>dim</i>-1)-faces that lie on the boundary of the triangulation.
     *
     * When a DualEdgeIterator is dereferenced, the resulting dual edge
     * must be given an orientation (as required by the DualEdge class).
     * If the corresponding (<i>dim</i>-1)-face of the triangulation is
     * \e f, then the orientation of the resulting dual edge will be from
     * `f.embedding(0).simplex()` to `f.embedding(1).simplex()`.
     * Note that the same dual edge could be given a different orientation
     * if it is obtained by some other means (e.g., by dereferencing an
     * IncidentDualEdgeIterator).
     *
     * This class implements the Boost multipass input iterator concept,
     * which is similar to the standard C++ forward iterator except that
     * the \a reference type may be the same as \a value_type (and so,
     * in particular, the dereference operator may return by value).
     *
     * \tparam dim the dimension of the underlying triangulation.
     */
    template <int dim>
    class DualEdgeIterator {
        public:
            using InternalIterator =
                    decltype(regina::detail::TriangulationBase<dim>().
                    faces<dim - 1>().begin());
                /**< The type used to iterate through (<i>dim</i>-1)-faces
                     of the underlying triangulation. */

            using iterator_category = std::input_iterator_tag;
                /**< Declares this to be an input iterator type. */
            using value_type = DualEdge;
                /**< Indicates what type the iterator points to. */
            using difference_type =
                    DualEdgeIterator::InternalIterator::difference_type;
                /**< The type obtained by subtracting iterators. */
            using pointer = DualEdge const*;
                /**< A pointer to \a value_type. */
            using reference = DualEdge;
                /**< The type obtained when dereferencing iterators.
                     Note that, for input iterators that are not forward
                     iterators, this does not need to be an actual C++
                     reference type. */

        private:
            InternalIterator it_;
                /**< The corresponding iterator through the list of all
                     (<i>dim</i>-1)-faces of the triangulation. */
            InternalIterator end_;
                /**< The end of the iterator range for all
                     (<i>dim</i>-1)-faces of the triangulation. */

        public:
            /**
             * Creates a singular iterator.
             */
            DualEdgeIterator() = default;
            /**
             * Creates a new copy of the given iterator.
             */
            DualEdgeIterator(const DualEdgeIterator&) = default;

            /**
             * Creates a new dual edge iterator corresponding to the given
             * position in the list of (<i>dim</i>-1)-faces of the
             * triangulation.
             *
             * If \a it points to a _boundary_ (<i>dim</i>-1)-face, then
             * the dual edge iterator will automatically skip through the list
             * of (<i>dim</i>-1)-faces until it either locates an internal
             * face or moves past-the-end.  For this reason, it is not
             * necessarily true that the dual edge `*this` will be
             * dual to the (<i>dim</i>-1)-face `*it`.
             *
             * \param it the corresponding iterator over the list of all
             * (<i>dim</i>-1)-faces of the underlying triangulation.
             * \param end the end of the iterator range for all
             * (<i>dim</i>-1)-faces of the underlying triangulation.
             * If the underlying triangulation is \a t, then this should be
             * `t.faces<dim-1>().end()`.
             */
            DualEdgeIterator(const InternalIterator& it,
                const InternalIterator& end);

            /**
             * Preincrement operator.
             *
             * \return a reference to this iterator.
             */
            DualEdgeIterator& operator ++ ();

            /**
             * Postincrement operator.
             *
             * \return a copy of this iterator before it was incremented.
             */
            DualEdgeIterator operator ++ (int);

            /**
             * Returns the dual edge to which this iterator points.
             *
             * If the corresponding (<i>dim</i>-1)-face of the triangulation
             * is \e f, then the resulting dual edge will be oriented
             * from `f.embedding(0).simplex()` to
             * `f.embedding(1).simplex()`.
             *
             * \pre This iterator is not past-the-end.
             *
             * \return the dual edge to which this iterator points.
             */
            DualEdge<dim> operator * () const;

            /**
             * Sets this to be a copy of the given iterator.
             *
             * \return a reference to this iterator.
             */
            DualEdgeIterator& operator = (const DualEdgeIterator&) = default;

            /**
             * Tests whether this and the given iterator are equal.
             *
             * \param rhs the iterator to compare with this.
             * \return \c true if and only if the two iterators are equal.
             */
            bool operator == (const DualEdgeIterator& rhs) const;

        private:
            /**
             * Update the internal data structures to put the iterator
             * in a valid state.
             *
             * Currently this just advances the internal (<i>dim</i>-1)-face
             * iterator until it does not point to a boundary facet of the
             * underlying triangulation.
             */
            void makeValid();
    };

    /**
     * Used to iterate through all dual edges incident to a given
     * dual vertex of a <i>dim</i>-dimensional triangulation.
     *
     * Let \a v denote this vertex; note that \a v corresponds to a
     * top-dimensional simplex of the triangulation.
     * The order of iteration will follow those dual edges that pass
     * through facets 0, 1, ..., \a dim of this simplex in turn.
     * Note however that the range of iterators may be smaller than
     * (<i>dim</i>+1), since a dual edge iterator will skip past those
     * facets of the simplex that lie on the boundary of the triangulation.
     *
     * When an IncidentDualEdgeIterator is dereferenced, the resulting dual
     * edge must be given an orientation (as required by the DualEdge class).
     * This orientation is determined by the template parameter \a out.
     * If \a out is \c true then the dual edges will be oriented away from
     * the dual vertex \a v (so \a v is the source), and if \a out is \c false
     * then they will be oriented towards \a v (so \a v is the target).
     *
     * This class implements the Boost multipass input iterator concept,
     * which is similar to the standard C++ forward iterator except that
     * the \a reference type may be the same as \a value_type (and so,
     * in particular, the dereference operator may return by value).
     *
     * \tparam dim the dimension of the underlying triangulation.
     * \tparam out indicates the orientation that will be assigned to
     * the incident dual edges, as described above.
     */
    template <int dim, bool out>
    class IncidentDualEdgeIterator {
        public:
            using iterator_category = std::input_iterator_tag;
                /**< Declares this to be an input iterator type. */
            using value_type = DualEdge;
                /**< Indicates what type the iterator points to. */
            using difference_type = int;
                /**< The type obtained by subtracting iterators. */
            using pointer = DualEdge const*;
                /**< A pointer to \a value_type. */
            using reference = DualEdge;
                /**< The type obtained when dereferencing iterators.
                     Note that, for input iterators that are not forward
                     iterators, this does not need to be an actual C++
                     reference type. */

        private:
            Simplex<dim>* simp_;
                /**< The dual vertex (i.e., top-dimensional simplex)
                     whose incident dual edges we are iterating through. */
            unsigned facet_;
                /**< The facet of \a simp_ through which the dual edge
                     that we are currently pointing to passes. */

        public:
            /**
             * Creates a singular iterator.
             */
            IncidentDualEdgeIterator();
            /**
             * Creates a new iterator that runs through all dual edges
             * incident to the given dual vertex.  The dual vertex is
             * specified by passing the corresponding top-dimensional
             * simplex \a simp in the underlying triangulation.
             *
             * The iterator will begin at the dual edge passing through facet
             * number \a facet of \a simp, assuming there is a simplex
             * on the other side.  However, if that is a boundary facet of the
             * triangulation, then the iterator will skip forward through the
             * list of facets until it either locates an internal facet
             * (with a simplex on the other side), or moves past-the-end
             * (facet number <i>dim</i>+1).
             *
             * \param simp the dual vertex (i.e., top-dimensional simplex)
             * whose incident dual edges we are iterating through.
             * \param facet indicates the facet of \a simp at which the
             * iteration should begin.  This must be between 0 and
             * (<i>dim</i>+1) inclusive, where a value of (<i>dim</i>+1)
             * indicates an iterator that is past-the-end.
             */
            IncidentDualEdgeIterator(Simplex<dim>* simp, unsigned facet = 0);
            /**
             * Creates a new copy of the given iterator.
             */
            IncidentDualEdgeIterator(const IncidentDualEdgeIterator&) = default;

            /**
             * Preincrement operator.
             *
             * \return a reference to this iterator.
             */
            IncidentDualEdgeIterator& operator ++ ();
            /**
             * Postincrement operator.
             *
             * \return a copy of this iterator before it was incremented.
             */
            IncidentDualEdgeIterator operator ++ (int);

            /**
             * Returns the dual edge to which this iterator points.
             *
             * Suppose we are iterating through dual edges incident to
             * the dual vertex \a V.  If the template parameter \a out
             * is \c true then the resulting dual edge will be oriented away
             * from \a V (so \a V is the source), and if \a out is \c false
             * then the dual edge will be oriented towards \a V (so \a V
             * is the target).
             *
             * \pre This iterator is not past-the-end.
             *
             * \return the dual edge to which this iterator points.
             */
            DualEdge<dim> operator * () const;

            /**
             * Sets this to be a copy of the given iterator.
             *
             * \return a reference to this iterator.
             */
            IncidentDualEdgeIterator& operator = (
                    const IncidentDualEdgeIterator&) = default;

            /**
             * Tests whether this and the given iterator are equal.
             *
             * \return \c true if and only if the two iterators are equal.
             */
            bool operator == (const IncidentDualEdgeIterator&) const = default;

        private:
            /**
             * Update the internal data structures to put the iterator
             * in a valid state.
             *
             * Currently this just advances the internal facet number until
             * it does not reference a boundary facet of the corresponding
             * simplex in the underlying triangulation.
             */
            void makeValid();
    };

    /**
     * Used to iterate through the dual vertices adjacent to a given
     * dual vertex of a <i>dim</i>-dimensional triangulation.
     *
     * Let \a v denote the given dual vertex; note that \a v corresponds to a
     * top-dimensional simplex of the triangulation.
     * The order of iteration will follow those dual vertices that are
     * adjacent through facets 0, 1, ..., \a dim of this simplex in turn.
     * Note however that the range of iterators may be smaller than
     * (<i>dim</i>+1), since an iterator will skip past those facets of the
     * simplex that lie on the boundary of the triangulation.
     *
     * This class implements the Boost multipass input iterator concept,
     * which is similar to the standard C++ forward iterator except that
     * the \a reference type may be the same as \a value_type (and so,
     * in particular, the dereference operator may return by value).
     *
     * \tparam dim the dimension of the underlying triangulation.
     */
    template <int dim>
    class AdjacentDualVertexIterator {
        public:
            using iterator_category = std::input_iterator_tag;
                /**< Declares this to be an input iterator type. */
            using value_type = regina::Simplex<dim>*;
                /**< Indicates what type the iterator points to. */
            using difference_type = int;
                /**< The type obtained by subtracting iterators. */
            using pointer = regina::Simplex<dim>* const*;
                /**< A pointer to \a value_type. */
            using reference = regina::Simplex<dim>*;
                /**< The type obtained when dereferencing iterators.
                     Note that, for input iterators that are not forward
                     iterators, this does not need to be an actual C++
                     reference type. */

        private:
            Simplex<dim>* source_;
                /**< The dual vertex (i.e., top-dimensional simplex)
                     whose adjacent dual vertices we are iterating through. */
            unsigned facet_;
                /**< The facet of \a simp_ through which the dual vertex
                     that we are currently pointing to lies. */

        public:
            /**
             * Default constructor that performs no initialisation.
             */
            AdjacentDualVertexIterator();
            /**
             * Creates a new iterator that runs through all dual vertices
             * adjacent to the given dual vertex.  The given dual vertex is
             * specified by passing the corresponding top-dimensional
             * simplex \a source in the underlying triangulation.
             *
             * The iterator will begin at the dual vertex (i.e.,
             * top-domensional simplex) attached to facet number \a facet of
             * \a simp, assuming that one exists.  However, if this is a
             * boundary facet of the triangulation, then the iterator will
             * skip forward through the list of facets until it either locates
             * an internal facet (with a simplex on the other side), or moves
             * past-the-end (facet number <i>dim</i>+1).
             *
             * \param source the dual vertex (i.e., top-dimensional simplex)
             * whose adjacent dual vertices we are iterating through.
             * \param facet indicates the facet of \a simp at which the
             * iteration should begin.  This must be between 0 and
             * (<i>dim</i>+1) inclusive, where a value of (<i>dim</i>+1)
             * indicates an iterator that is past-the-end.
             */
            AdjacentDualVertexIterator(
                Simplex<dim>* source, unsigned facet = 0);
            /**
             * Creates a new copy of the given iterator.
             */
            AdjacentDualVertexIterator(const AdjacentDualVertexIterator&) =
                default;

            /**
             * Preincrement operator.
             *
             * \return a reference to this iterator.
             */
            AdjacentDualVertexIterator& operator ++ ();
            /**
             * Postincrement operator.
             *
             * \return a copy of this iterator before it was incremented.
             */
            AdjacentDualVertexIterator operator ++ (int);

            /**
             * Returns the dual vertex (that is, the top-dimensional simplex)
             * to which this iterator points.
             *
             * \pre This iterator is not past-the-end.
             *
             * \return the dual vertex to which this iterator points.
             */
            Simplex<dim>* operator * () const;

            /**
             * Sets this to be a copy of the given iterator.
             *
             * \return a reference to this iterator.
             */
            AdjacentDualVertexIterator& operator = (
                    const AdjacentDualVertexIterator&) = default;

            /**
             * Tests whether this and the given iterator are equal.
             *
             * \return \c true if and only if the two iterators are equal.
             */
            bool operator == (const AdjacentDualVertexIterator&) const =
                default;

        private:
            /**
             * Ensures that this iterator does not reference a boundary facet
             * of the corresponding simplex in the underlying triangulation.
             */
            void skipBoundary();
    };

    /**
     * Allows the Boost Graph Library to access inherent properties of the
     * dual graph of a triangulation.  Here "inherent properties" means
     * properties that are already stored as part of the triangulation,
     * as opposed to a list of additional properties that are stored
     * separately.
     *
     * This class is lightweight - it contains no data or no methods.
     * Its only use is to convey type information - specifically, to
     * indicate to other Boost routines what property is being queried.
     *
     * This class implements the Boost readable property map concept.
     *
     * \tparam dim the dimension of the triangulation whose dual graph
     * is being studied.
     * \tparam PropertyType specifies which graph property is to be studied.
     * This type must model the Boost property tag concept.  Currently
     * supported properties include boost::vertex_index_t and
     * boost::vertex_name_t.
     */
    template <int dim, typename PropertyType>
    class InherentTriangulationPropertyMap {
    };

    } // leaving namespace regina::graph, returning to namespace regina

    /**
     * Returns an iterator range containing all vertices of the
     * dual graph of the given triangulation.  This routine is
     * compatible with the Boost Graph Library, where Triangulation<dim>
     * can be used directly as the underlying graph type.
     *
     * \param t the triangulation whose dual graph we are studying.
     * \return the range of all dual vertices of \a t, presented as a
     * std::pair of simplex iterators.
     */
    template <int dim>
    auto vertices(const Triangulation<dim>& t);

    /**
     * Returns an iterator range containing all edges of the
     * dual graph of the given triangulation.  This routine is
     * compatible with the Boost Graph Library, where Triangulation<dim>
     * can be used directly as the underlying graph type.
     *
     * \param t the triangulation whose dual graph we are studying.
     * \return the range of all dual edges of \a t.
     */
    template <int dim>
    std::pair<graph::DualEdgeIterator<dim>, graph::DualEdgeIterator<dim>>
        edges(const Triangulation<dim>& t);

    /**
     * Returns the number of vertices in the dual graph of the given
     * triangulation.  This routine is compatible with the Boost Graph Library,
     * where Triangulation<dim> can be used directly as the underlying graph
     * type.
     *
     * \param t the triangulation whose dual graph we are studying.
     * \return the number of dual vertices of \a t.
     */
    template <int dim>
    size_t num_vertices(const Triangulation<dim>& t);

    /**
     * Returns the number of edges in the dual graph of the given
     * triangulation.  This routine is compatible with the Boost Graph Library,
     * where Triangulation<dim> can be used directly as the underlying graph
     * type.
     *
     * \param t the triangulation whose dual graph we are studying.
     * \return the number of dual edges of \a t.
     */
    template <int dim>
    size_t num_edges(const Triangulation<dim>& t);

    /**
     * Returns the source vertex of the given oriented edge in the
     * dual graph of the given triangulation.  This routine is compatible
     * with the Boost Graph Library, where Triangulation<dim> can be used
     * directly as the underlying graph type.
     *
     * Note that the dual graph of a triangulation is undirected, and so
     * the orientation of a dual edge (i.e., its choice of source and
     * target vertices) will depend upon how that dual edge was obtained.
     * In particular, the same dual edge may be returned with different
     * orientations when accessed through different routines.  See the
     * class DualEdgeIterator and IncidentDualEdgeIterator for details.
     *
     * \param e the edge of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the source vertex of the dual edge \a e.
     */
    template <int dim>
    Simplex<dim>* source(graph::DualEdge<dim> e, const Triangulation<dim>& t);

    /**
     * Returns the target vertex of the given oriented edge in the
     * dual graph of the given triangulation.  This routine is compatible
     * with the Boost Graph Library, where Triangulation<dim> can be used
     * directly as the underlying graph type.
     *
     * Note that the dual graph of a triangulation is undirected, and so
     * the orientation of a dual edge (i.e., its choice of source and
     * target vertices) will depend upon how that dual edge was obtained.
     * In particular, the same dual edge may be returned with different
     * orientations when accessed through different routines.  See the
     * class DualEdgeIterator and IncidentDualEdgeIterator for details.
     *
     * \param e the edge of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the target vertex of the dual edge \a e.
     */
    template <int dim>
    Simplex<dim>* target(graph::DualEdge<dim> e, const Triangulation<dim>& t);

    /**
     * Returns the degree of the given vertex in the dual graph of the given
     * triangulation.  This routine is compatible with the Boost Graph Library,
     * where Triangulation<dim> can be used directly as the underlying graph
     * type.
     *
     * Since the dual graph of a triangulation is undirected, the
     * routines degree(), in_degree() and out_degree() all return the
     * same answers.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the degree of the dual vertex \a v.
     */
    template <int dim>
    unsigned degree(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns the degree of the given vertex in the dual graph of the given
     * triangulation.  This routine is compatible with the Boost Graph Library,
     * where Triangulation<dim> can be used directly as the underlying graph
     * type.
     *
     * Since the dual graph of a triangulation is undirected, the
     * routines degree(), in_degree() and out_degree() all return the
     * same answers.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the degree of the dual vertex \a v.
     */
    template <int dim>
    unsigned in_degree(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns the degree of the given vertex in the dual graph of the given
     * triangulation.  This routine is compatible with the Boost Graph Library,
     * where Triangulation<dim> can be used directly as the underlying graph
     * type.
     *
     * Since the dual graph of a triangulation is undirected, the
     * routines degree(), in_degree() and out_degree() all return the
     * same answers.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the degree of the dual vertex \a v.
     */
    template <int dim>
    unsigned out_degree(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns an iterator range containing all vertices adjacent to the
     * given vertex of the dual graph of the given triangulation.  This
     * routine is compatible with the Boost Graph Library, where
     * Triangulation<dim> can be used directly as the underlying graph type.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the range of all dual vertices adjacent to \a v.
     */
    template <int dim>
    std::pair<graph::AdjacentDualVertexIterator<dim>,
            graph::AdjacentDualVertexIterator<dim>>
        adjacent_vertices(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns an iterator range containing all edges incident with the
     * given vertex of the dual graph of the given triangulation.  This
     * routine is compatible with the Boost Graph Library, where
     * Triangulation<dim> can be used directly as the underlying graph type.
     *
     * The dual edges in this range will all be oriented towards \a v
     * (i.e., \a v will appear as the target of each edge).
     *
     * \note The routine out_edges() returns the same range of dual edges,
     * but oriented in the opposite direction.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the range of all dual edges incident with \a v.
     */
    template <int dim>
    std::pair<graph::IncidentDualEdgeIterator<dim, false>,
            graph::IncidentDualEdgeIterator<dim, false>>
        in_edges(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns an iterator range containing all edges incident with the
     * given vertex of the dual graph of the given triangulation.  This
     * routine is compatible with the Boost Graph Library, where
     * Triangulation<dim> can be used directly as the underlying graph type.
     *
     * The dual edges in this range will all be oriented away from \a v
     * (i.e., \a v will appear as the source of each edge).
     *
     * \note The routine in_edges() returns the same range of dual edges,
     * but oriented in the opposite direction.
     *
     * \param v the vertex of the dual graph that we are examining.
     * \param t the dual graph itself (i.e., the underlying triangulation).
     * \return the range of all dual edges incident with \a v.
     */
    template <int dim>
    std::pair<graph::IncidentDualEdgeIterator<dim, true>,
            graph::IncidentDualEdgeIterator<dim, true>>
        out_edges(Simplex<dim>* v, const Triangulation<dim>& t);

    /**
     * Returns the index of the given vertex of the dual graph of a
     * triangulation.  This routine is compatible with the Boost Graph
     * Library, where Triangulation<dim> can be used directly as the
     * underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     *
     * \param v the vertex of the dual graph that we are examining.
     * \return the index of the top-dimensional simplex corresponding to
     * \a v in the underlying triangulation.
     */
    template <int dim>
    size_t get(
        graph::InherentTriangulationPropertyMap<dim, boost::vertex_index_t>,
        Simplex<dim>* v);

    /**
     * Returns the description of the given vertex of the dual graph of a
     * triangulation.  This routine is compatible with the Boost Graph
     * Library, where Triangulation<dim> can be used directly as the
     * underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     *
     * \param v the vertex of the dual graph that we are examining.
     * \return the description of the top-dimensional simplex corresponding to
     * \a v in the underlying triangulation.
     */
    template <int dim>
    const std::string& get(
        graph::InherentTriangulationPropertyMap<dim, boost::vertex_name_t>,
        Simplex<dim>* v);

    /**
     * Returns a Boost property map that can be used to query indices
     * of vertices in the dual graph of a triangulation.  This routine is
     * compatible with the Boost Graph Library, where Triangulation<dim>
     * can be used directly as the underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     * Likewise, the second argument does not matter, since this type of
     * property map carries no data; however, it would typically be the
     * triangulation whose dual graph we are studying.
     *
     * \return a property map for querying indices of dual vertices.
     */
    template <int dim>
    graph::InherentTriangulationPropertyMap<dim, boost::vertex_index_t> get(
        boost::vertex_index_t, const Triangulation<dim>&);

    /**
     * Returns a Boost property map that can be used to query descriptions
     * of vertices in the dual graph of a triangulation.  This routine is
     * compatible with the Boost Graph Library, where Triangulation<dim>
     * can be used directly as the underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     * Likewise, the second argument does not matter, since this type of
     * property map carries no data; however, it would typically be the
     * triangulation whose dual graph we are studying.
     *
     * \return a property map for querying descriptions of dual vertices.
     */
    template <int dim>
    graph::InherentTriangulationPropertyMap<dim, boost::vertex_name_t> get(
        boost::vertex_name_t, const Triangulation<dim>&);

    /**
     * Returns the index of the given vertex of the dual graph of a
     * triangulation.  This routine is compatible with the Boost Graph
     * Library, where Triangulation<dim> can be used directly as the
     * underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     * Likewise, the second argument does not matter (but typically it
     * would be the triangulation whose dual graph we are studying).
     *
     * \param v the vertex of the dual graph that we are examining.
     * \return the index of the top-dimensional simplex corresponding to
     * \a v in the underlying triangulation.
     */
    template <int dim>
    size_t get(boost::vertex_index_t, const Triangulation<dim>&,
            Simplex<dim>* v);

    /**
     * Returns the description of the given vertex of the dual graph of a
     * triangulation.  This routine is compatible with the Boost Graph
     * Library, where Triangulation<dim> can be used directly as the
     * underlying graph type.
     *
     * The first argument does not matter: it is only used to convey
     * type information (to indicate which graph property is being queried).
     * Likewise, the second argument does not matter (but typically it
     * would be the triangulation whose dual graph we are studying).
     *
     * \param v the vertex of the dual graph that we are examining.
     * \return the description of the top-dimensional simplex corresponding to
     * \a v in the underlying triangulation.
     */
    template <int dim>
    const std::string& get(boost::vertex_name_t, const Triangulation<dim>&,
            Simplex<dim>* v);

} // namespace regina

namespace boost {
    template <int dim>
    struct property_traits<
            regina::graph::InherentTriangulationPropertyMap<
            dim, boost::vertex_index_t>> {
        using value_type = size_t;
        using reference = size_t;
        using key_type = regina::Simplex<dim>*;
        using category = boost::readable_property_map_tag;
    };

    template <int dim>
    struct property_traits<
            regina::graph::InherentTriangulationPropertyMap<
            dim, boost::vertex_name_t>> {
        using value_type = std::string;
        using reference = const std::string&;
        using key_type = regina::Simplex<dim>*;
        using category = boost::readable_property_map_tag;
    };

    template <int dim, typename PropertyType>
    struct property_map<regina::Triangulation<dim>, PropertyType> {
        using const_type =
            regina::graph::InherentTriangulationPropertyMap<dim, PropertyType>;
    };

    template <int dim>
    struct graph_traits<regina::Triangulation<dim>> {
        using vertex_descriptor = regina::Simplex<dim>*;
        using edge_descriptor = typename regina::graph::DualEdge<dim>;
        using directed_category = boost::undirected_tag;
        using edge_parallel_category = boost::allow_parallel_edge_tag;
        struct traversal_category :
                public boost::vertex_list_graph_tag,
                public boost::edge_list_graph_tag,
                public boost::adjacency_graph_tag,
                public boost::bidirectional_graph_tag {
        };
        using vertex_iterator =
            decltype(regina::Triangulation<dim>().simplices().begin());
        using edge_iterator = typename regina::graph::DualEdgeIterator<dim>;
        using adjacency_iterator =
            typename regina::graph::AdjacentDualVertexIterator<dim>;
        using in_edge_iterator =
            typename regina::graph::IncidentDualEdgeIterator<dim, false>;
        using out_edge_iterator =
            typename regina::graph::IncidentDualEdgeIterator<dim, true>;
        using vertices_size_type = size_t;
        using edges_size_type = size_t;
        using degree_size_type = unsigned;

        static vertex_descriptor null_vertex() {
            return nullptr;
        };
    };
} // namespace boost

namespace regina {
namespace graph {

    // Inline functions for DualEdge

    template <int dim>
    inline DualEdge<dim>::DualEdge(
            const Face<dim, dim-1>* face_, bool forward_) :
            face(face_), forward(forward_) {
    }

    template <int dim>
    inline Simplex<dim>* DualEdge<dim>::source() const {
        return face->embedding(forward ? 0 : 1).simplex();
    }

    template <int dim>
    inline Simplex<dim>* DualEdge<dim>::target() const {
        return face->embedding(forward ? 1 : 0).simplex();
    }

    // Inline functions for DualEdgeIterator

    template <int dim>
    inline DualEdgeIterator<dim>::DualEdgeIterator(
            const InternalIterator& it, const InternalIterator& end) :
            it_(it), end_(end) {
        makeValid();
    }

    template <int dim>
    inline DualEdgeIterator<dim>& DualEdgeIterator<dim>::operator ++ () {
        ++it_;
        makeValid();
        return *this;
    }

    template <int dim>
    inline DualEdgeIterator<dim> DualEdgeIterator<dim>::operator ++ (int) {
        return DualEdgeIterator(it_++, end_);
    }

    template <int dim>
    inline DualEdge<dim> DualEdgeIterator<dim>::operator * () const {
        return DualEdge<dim>(*it_);
    }

    template <int dim>
    inline bool DualEdgeIterator<dim>::operator == (const DualEdgeIterator& rhs)
            const {
        return it_ == rhs.it_;
    }

    template <int dim>
    inline void DualEdgeIterator<dim>::makeValid() {
        while (it_ != end_ && (*it_)->isBoundary())
            ++it_;
    }

    // Inline functions for IncidentDualEdgeIterator

    template <int dim, bool out>
    inline IncidentDualEdgeIterator<dim, out>::IncidentDualEdgeIterator() :
            simp_(0), facet_(0) {
    }

    template <int dim, bool out>
    inline IncidentDualEdgeIterator<dim, out>::IncidentDualEdgeIterator(
            Simplex<dim>* simp, unsigned facet) :
            simp_(simp), facet_(facet) {
        makeValid();
    }

    template <int dim, bool out>
    inline IncidentDualEdgeIterator<dim, out>&
            IncidentDualEdgeIterator<dim, out>::operator ++ () {
        ++facet_;
        makeValid();
        return *this;
    }

    template <int dim, bool out>
    inline IncidentDualEdgeIterator<dim, out>
            IncidentDualEdgeIterator<dim, out>::operator ++ (int) {
        IncidentDualEdgeIterator prev(*this);
        ++facet_;
        makeValid();
        return prev;
    }

    template <int dim, bool out>
    inline DualEdge<dim> IncidentDualEdgeIterator<dim, out>::operator * ()
            const {
        Face<dim, dim-1>* f = simp_->template face<dim-1>(facet_);
        auto& emb = f->embedding(out ? 0 : 1);
        return DualEdge<dim>(f, emb.simplex() == simp_ && emb.face() == facet_);
    }

    template <int dim, bool out>
    inline void IncidentDualEdgeIterator<dim, out>::makeValid() {
        while (facet_ <= dim && ! simp_->adjacentSimplex(facet_))
            ++facet_;
    }

    // Inline functions for AdjacentDualVertexIterator

    template <int dim>
    inline AdjacentDualVertexIterator<dim>::AdjacentDualVertexIterator() :
            source_(0) {
    }

    template <int dim>
    inline AdjacentDualVertexIterator<dim>::AdjacentDualVertexIterator(
            Simplex<dim>* source, unsigned facet) :
            source_(source), facet_(facet) {
        skipBoundary();
    }

    template <int dim>
    inline AdjacentDualVertexIterator<dim>&
            AdjacentDualVertexIterator<dim>::operator ++ () {
        ++facet_;
        skipBoundary();
        return *this;
    }

    template <int dim>
    inline AdjacentDualVertexIterator<dim>
            AdjacentDualVertexIterator<dim>::operator ++ (int) {
        AdjacentDualVertexIterator prev(*this);
        ++facet_;
        skipBoundary();
        return prev;
    }

    template <int dim>
    inline Simplex<dim>* AdjacentDualVertexIterator<dim>::operator * () const {
        return source_->adjacentSimplex(facet_);
    }

    template <int dim>
    inline void AdjacentDualVertexIterator<dim>::skipBoundary() {
        while (facet_ <= dim && ! source_->adjacentSimplex(facet_))
            ++facet_;
    }

    } // leaving namespace regina::graph, returning to namespace regina

    // Inline BGL functions

    template <int dim>
    inline auto vertices(const Triangulation<dim>& t) {
        return std::make_pair(t.simplices().begin(), t.simplices().end());
    }

    template <int dim>
    inline std::pair<graph::DualEdgeIterator<dim>, graph::DualEdgeIterator<dim>>
            edges(const Triangulation<dim>& t) {
        return std::make_pair(
            graph::DualEdgeIterator<dim>(t.template faces<dim-1>().begin(),
                t.template faces<dim-1>().end()),
            graph::DualEdgeIterator<dim>(t.template faces<dim-1>().end(),
                t.template faces<dim-1>().end()));
    }

    template <int dim>
    inline size_t num_vertices(const Triangulation<dim>& t) {
        return t.size();
    }

    template <int dim>
    inline size_t num_edges(const Triangulation<dim>& t) {
        return t.template countFaces<dim-1>() - t.countBoundaryFacets();
    }

    template <int dim>
    inline Simplex<dim>* source(graph::DualEdge<dim> e,
            const Triangulation<dim>&) {
        return e.source();
    }

    template <int dim>
    inline Simplex<dim>* target(graph::DualEdge<dim> e,
            const Triangulation<dim>&) {
        return e.target();
    }

    template <int dim>
    inline unsigned degree(Simplex<dim>* source, const Triangulation<dim>&) {
        unsigned ans = 0;
        for (unsigned i = 0; i <= dim; ++i)
            if (source->adjacentSimplex(i))
                ++ans;
        return ans;
    }

    template <int dim>
    inline unsigned in_degree(Simplex<dim>* source,
            const Triangulation<dim>& t) {
        return degree(source, t);
    }

    template <int dim>
    inline unsigned out_degree(Simplex<dim>* source,
            const Triangulation<dim>& t) {
        return degree(source, t);
    }

    template <int dim>
    inline std::pair<graph::AdjacentDualVertexIterator<dim>,
            graph::AdjacentDualVertexIterator<dim>>
            adjacent_vertices(Simplex<dim>* source, const Triangulation<dim>&) {
        return std::make_pair(
            graph::AdjacentDualVertexIterator<dim>(source, 0),
            graph::AdjacentDualVertexIterator<dim>(source, dim + 1));
    }

    template <int dim>
    inline std::pair<graph::IncidentDualEdgeIterator<dim, false>,
            graph::IncidentDualEdgeIterator<dim, false>>
            in_edges(Simplex<dim>* source, const Triangulation<dim>&) {
        return std::make_pair(
            graph::IncidentDualEdgeIterator<dim, false>(source, 0),
            graph::IncidentDualEdgeIterator<dim, false>(source, dim + 1));
    }

    template <int dim>
    inline std::pair<graph::IncidentDualEdgeIterator<dim, true>,
            graph::IncidentDualEdgeIterator<dim, true>>
            out_edges(Simplex<dim>* source, const Triangulation<dim>&) {
        return std::make_pair(
            graph::IncidentDualEdgeIterator<dim, true>(source, 0),
            graph::IncidentDualEdgeIterator<dim, true>(source, dim + 1));
    }

    template <int dim>
    inline size_t get(
            graph::InherentTriangulationPropertyMap<dim, boost::vertex_index_t>,
            Simplex<dim>* v) {
        return v->index();
    }

    template <int dim>
    inline const std::string& get(
            graph::InherentTriangulationPropertyMap<dim, boost::vertex_name_t>,
            Simplex<dim>* v) {
        return v->description();
    }

    template <int dim>
    inline graph::InherentTriangulationPropertyMap<dim, boost::vertex_index_t>
            get(boost::vertex_index_t, const Triangulation<dim>&) {
        return graph::InherentTriangulationPropertyMap<
            dim, boost::vertex_index_t>();
    }

    template <int dim>
    inline graph::InherentTriangulationPropertyMap<dim, boost::vertex_name_t>
            get(boost::vertex_name_t, const Triangulation<dim>&) {
        return graph::InherentTriangulationPropertyMap<
            dim, boost::vertex_name_t>();
    }

    template <int dim>
    inline size_t get(
            boost::vertex_index_t, const Triangulation<dim>&, Simplex<dim>* v) {
        return v->index();
    }

    template <int dim>
    inline const std::string& get(
            boost::vertex_name_t, const Triangulation<dim>&, Simplex<dim>* v) {
        return v->desc();
    }

} // namespace regina

#endif