gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Fix the usage of tags in adaptors.h (#67) There are separate tags for arcs and edges now.
0 1 0
default
1 file changed with 33 insertions and 20 deletions:
↑ Collapse diff ↑
Show white space 48 line context
... ...
@@ -49,52 +49,52 @@
49 49
    void setDigraph(Digraph& digraph) { _digraph = &digraph; }
50 50

	
51 51
  public:
52 52
    DigraphAdaptorBase(Digraph& digraph) : _digraph(&digraph) { }
53 53

	
54 54
    typedef typename Digraph::Node Node;
55 55
    typedef typename Digraph::Arc Arc;
56 56

	
57 57
    void first(Node& i) const { _digraph->first(i); }
58 58
    void first(Arc& i) const { _digraph->first(i); }
59 59
    void firstIn(Arc& i, const Node& n) const { _digraph->firstIn(i, n); }
60 60
    void firstOut(Arc& i, const Node& n ) const { _digraph->firstOut(i, n); }
61 61

	
62 62
    void next(Node& i) const { _digraph->next(i); }
63 63
    void next(Arc& i) const { _digraph->next(i); }
64 64
    void nextIn(Arc& i) const { _digraph->nextIn(i); }
65 65
    void nextOut(Arc& i) const { _digraph->nextOut(i); }
66 66

	
67 67
    Node source(const Arc& a) const { return _digraph->source(a); }
68 68
    Node target(const Arc& a) const { return _digraph->target(a); }
69 69

	
70 70
    typedef NodeNumTagIndicator<Digraph> NodeNumTag;
71 71
    int nodeNum() const { return _digraph->nodeNum(); }
72 72

	
73
    typedef EdgeNumTagIndicator<Digraph> EdgeNumTag;
73
    typedef ArcNumTagIndicator<Digraph> ArcNumTag;
74 74
    int arcNum() const { return _digraph->arcNum(); }
75 75

	
76
    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
76
    typedef FindArcTagIndicator<Digraph> FindArcTag;
77 77
    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
78 78
      return _digraph->findArc(u, v, prev);
79 79
    }
80 80

	
81 81
    Node addNode() { return _digraph->addNode(); }
82 82
    Arc addArc(const Node& u, const Node& v) { return _digraph->addArc(u, v); }
83 83

	
84 84
    void erase(const Node& n) const { _digraph->erase(n); }
85 85
    void erase(const Arc& a) const { _digraph->erase(a); }
86 86

	
87 87
    void clear() const { _digraph->clear(); }
88 88

	
89 89
    int id(const Node& n) const { return _digraph->id(n); }
90 90
    int id(const Arc& a) const { return _digraph->id(a); }
91 91

	
92 92
    Node nodeFromId(int ix) const { return _digraph->nodeFromId(ix); }
93 93
    Arc arcFromId(int ix) const { return _digraph->arcFromId(ix); }
94 94

	
95 95
    int maxNodeId() const { return _digraph->maxNodeId(); }
96 96
    int maxArcId() const { return _digraph->maxArcId(); }
97 97

	
98 98
    typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
99 99
    NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
100 100

	
... ...
@@ -177,56 +177,60 @@
177 177
    void first(Arc& i) const { _graph->first(i); }
178 178
    void first(Edge& i) const { _graph->first(i); }
179 179
    void firstIn(Arc& i, const Node& n) const { _graph->firstIn(i, n); }
180 180
    void firstOut(Arc& i, const Node& n ) const { _graph->firstOut(i, n); }
181 181
    void firstInc(Edge &i, bool &d, const Node &n) const {
182 182
      _graph->firstInc(i, d, n);
183 183
    }
184 184

	
185 185
    void next(Node& i) const { _graph->next(i); }
186 186
    void next(Arc& i) const { _graph->next(i); }
187 187
    void next(Edge& i) const { _graph->next(i); }
188 188
    void nextIn(Arc& i) const { _graph->nextIn(i); }
189 189
    void nextOut(Arc& i) const { _graph->nextOut(i); }
190 190
    void nextInc(Edge &i, bool &d) const { _graph->nextInc(i, d); }
191 191

	
192 192
    Node u(const Edge& e) const { return _graph->u(e); }
193 193
    Node v(const Edge& e) const { return _graph->v(e); }
194 194

	
195 195
    Node source(const Arc& a) const { return _graph->source(a); }
196 196
    Node target(const Arc& a) const { return _graph->target(a); }
197 197

	
198 198
    typedef NodeNumTagIndicator<Graph> NodeNumTag;
199 199
    int nodeNum() const { return _graph->nodeNum(); }
200 200

	
201
    typedef ArcNumTagIndicator<Graph> ArcNumTag;
202
    int arcNum() const { return _graph->arcNum(); }
203

	
201 204
    typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
202
    int arcNum() const { return _graph->arcNum(); }
203 205
    int edgeNum() const { return _graph->edgeNum(); }
204 206

	
205
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
207
    typedef FindArcTagIndicator<Graph> FindArcTag;
206 208
    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
207 209
      return _graph->findArc(u, v, prev);
208 210
    }
211

	
212
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
209 213
    Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) {
210 214
      return _graph->findEdge(u, v, prev);
211 215
    }
212 216

	
213 217
    Node addNode() { return _graph->addNode(); }
214 218
    Edge addEdge(const Node& u, const Node& v) { return _graph->addEdge(u, v); }
215 219

	
216 220
    void erase(const Node& i) { _graph->erase(i); }
217 221
    void erase(const Edge& i) { _graph->erase(i); }
218 222

	
219 223
    void clear() { _graph->clear(); }
220 224

	
221 225
    bool direction(const Arc& a) const { return _graph->direction(a); }
222 226
    Arc direct(const Edge& e, bool d) const { return _graph->direct(e, d); }
223 227

	
224 228
    int id(const Node& v) const { return _graph->id(v); }
225 229
    int id(const Arc& a) const { return _graph->id(a); }
226 230
    int id(const Edge& e) const { return _graph->id(e); }
227 231

	
228 232
    Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
229 233
    Arc arcFromId(int ix) const { return _graph->arcFromId(ix); }
230 234
    Edge edgeFromId(int ix) const { return _graph->edgeFromId(ix); }
231 235

	
232 236
    int maxNodeId() const { return _graph->maxNodeId(); }
... ...
@@ -309,49 +313,49 @@
309 313
  };
310 314

	
311 315
  template <typename _Digraph>
312 316
  class ReverseDigraphBase : public DigraphAdaptorBase<_Digraph> {
313 317
  public:
314 318
    typedef _Digraph Digraph;
315 319
    typedef DigraphAdaptorBase<_Digraph> Parent;
316 320
  protected:
317 321
    ReverseDigraphBase() : Parent() { }
318 322
  public:
319 323
    typedef typename Parent::Node Node;
320 324
    typedef typename Parent::Arc Arc;
321 325

	
322 326
    void firstIn(Arc& a, const Node& n) const { Parent::firstOut(a, n); }
323 327
    void firstOut(Arc& a, const Node& n ) const { Parent::firstIn(a, n); }
324 328

	
325 329
    void nextIn(Arc& a) const { Parent::nextOut(a); }
326 330
    void nextOut(Arc& a) const { Parent::nextIn(a); }
327 331

	
328 332
    Node source(const Arc& a) const { return Parent::target(a); }
329 333
    Node target(const Arc& a) const { return Parent::source(a); }
330 334

	
331 335
    Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); }
332 336

	
333
    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
337
    typedef FindArcTagIndicator<Digraph> FindArcTag;
334 338
    Arc findArc(const Node& u, const Node& v,
335 339
                const Arc& prev = INVALID) {
336 340
      return Parent::findArc(v, u, prev);
337 341
    }
338 342

	
339 343
  };
340 344

	
341 345
  /// \ingroup graph_adaptors
342 346
  ///
343 347
  /// \brief A digraph adaptor which reverses the orientation of the arcs.
344 348
  ///
345 349
  /// ReverseDigraph reverses the arcs in the adapted digraph. The
346 350
  /// SubDigraph is conform to the \ref concepts::Digraph
347 351
  /// "Digraph concept".
348 352
  ///
349 353
  /// \tparam _Digraph It must be conform to the \ref concepts::Digraph
350 354
  /// "Digraph concept". The type can be specified to be const.
351 355
  template<typename _Digraph>
352 356
  class ReverseDigraph :
353 357
    public DigraphAdaptorExtender<ReverseDigraphBase<_Digraph> > {
354 358
  public:
355 359
    typedef _Digraph Digraph;
356 360
    typedef DigraphAdaptorExtender<
357 361
      ReverseDigraphBase<_Digraph> > Parent;
... ...
@@ -446,51 +450,51 @@
446 450
    void nextIn(Arc& i) const {
447 451
      Parent::nextIn(i);
448 452
      while (i != INVALID && (!(*_arc_filter)[i]
449 453
                              || !(*_node_filter)[Parent::source(i)]))
450 454
        Parent::nextIn(i);
451 455
    }
452 456

	
453 457
    void nextOut(Arc& i) const {
454 458
      Parent::nextOut(i);
455 459
      while (i != INVALID && (!(*_arc_filter)[i]
456 460
                              || !(*_node_filter)[Parent::target(i)]))
457 461
        Parent::nextOut(i);
458 462
    }
459 463

	
460 464
    void hide(const Node& n) const { _node_filter->set(n, false); }
461 465
    void hide(const Arc& a) const { _arc_filter->set(a, false); }
462 466

	
463 467
    void unHide(const Node& n) const { _node_filter->set(n, true); }
464 468
    void unHide(const Arc& a) const { _arc_filter->set(a, true); }
465 469

	
466 470
    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
467 471
    bool hidden(const Arc& a) const { return !(*_arc_filter)[a]; }
468 472

	
469 473
    typedef False NodeNumTag;
470
    typedef False EdgeNumTag;
471

	
472
    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
474
    typedef False ArcNumTag;
475

	
476
    typedef FindArcTagIndicator<Digraph> FindArcTag;
473 477
    Arc findArc(const Node& source, const Node& target,
474 478
                const Arc& prev = INVALID) {
475 479
      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
476 480
        return INVALID;
477 481
      }
478 482
      Arc arc = Parent::findArc(source, target, prev);
479 483
      while (arc != INVALID && !(*_arc_filter)[arc]) {
480 484
        arc = Parent::findArc(source, target, arc);
481 485
      }
482 486
      return arc;
483 487
    }
484 488

	
485 489
    template <typename _Value>
486 490
    class NodeMap : public SubMapExtender<Adaptor,
487 491
      typename Parent::template NodeMap<_Value> > {
488 492
    public:
489 493
      typedef _Value Value;
490 494
      typedef SubMapExtender<Adaptor, typename Parent::
491 495
                             template NodeMap<Value> > MapParent;
492 496

	
493 497
      NodeMap(const Adaptor& adaptor)
494 498
        : MapParent(adaptor) {}
495 499
      NodeMap(const Adaptor& adaptor, const Value& value)
496 500
        : MapParent(adaptor, value) {}
... ...
@@ -589,51 +593,51 @@
589 593
    void next(Arc& i) const {
590 594
      Parent::next(i);
591 595
      while (i!=INVALID && !(*_arc_filter)[i]) Parent::next(i);
592 596
    }
593 597
    void nextIn(Arc& i) const {
594 598
      Parent::nextIn(i);
595 599
      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextIn(i);
596 600
    }
597 601

	
598 602
    void nextOut(Arc& i) const {
599 603
      Parent::nextOut(i);
600 604
      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextOut(i);
601 605
    }
602 606

	
603 607
    void hide(const Node& n) const { _node_filter->set(n, false); }
604 608
    void hide(const Arc& e) const { _arc_filter->set(e, false); }
605 609

	
606 610
    void unHide(const Node& n) const { _node_filter->set(n, true); }
607 611
    void unHide(const Arc& e) const { _arc_filter->set(e, true); }
608 612

	
609 613
    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
610 614
    bool hidden(const Arc& e) const { return !(*_arc_filter)[e]; }
611 615

	
612 616
    typedef False NodeNumTag;
613
    typedef False EdgeNumTag;
614

	
615
    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
617
    typedef False ArcNumTag;
618

	
619
    typedef FindArcTagIndicator<Digraph> FindArcTag;
616 620
    Arc findArc(const Node& source, const Node& target,
617 621
                const Arc& prev = INVALID) {
618 622
      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
619 623
        return INVALID;
620 624
      }
621 625
      Arc arc = Parent::findArc(source, target, prev);
622 626
      while (arc != INVALID && !(*_arc_filter)[arc]) {
623 627
        arc = Parent::findArc(source, target, arc);
624 628
      }
625 629
      return arc;
626 630
    }
627 631

	
628 632
    template <typename _Value>
629 633
    class NodeMap : public SubMapExtender<Adaptor,
630 634
      typename Parent::template NodeMap<_Value> > {
631 635
    public:
632 636
      typedef _Value Value;
633 637
      typedef SubMapExtender<Adaptor, typename Parent::
634 638
                             template NodeMap<Value> > MapParent;
635 639

	
636 640
      NodeMap(const Adaptor& adaptor)
637 641
        : MapParent(adaptor) {}
638 642
      NodeMap(const Adaptor& adaptor, const Value& value)
639 643
        : MapParent(adaptor, value) {}
... ...
@@ -914,62 +918,65 @@
914 918
      Parent::nextOut(i);
915 919
      while (i!=INVALID && (!(*_edge_filter_map)[i]
916 920
                            || !(*_node_filter_map)[Parent::target(i)]))
917 921
        Parent::nextOut(i);
918 922
    }
919 923

	
920 924
    void nextInc(Edge& i, bool& d) const {
921 925
      Parent::nextInc(i, d);
922 926
      while (i!=INVALID && (!(*_edge_filter_map)[i]
923 927
                            || !(*_node_filter_map)[Parent::u(i)]
924 928
                            || !(*_node_filter_map)[Parent::v(i)]))
925 929
        Parent::nextInc(i, d);
926 930
    }
927 931

	
928 932
    void hide(const Node& n) const { _node_filter_map->set(n, false); }
929 933
    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
930 934

	
931 935
    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
932 936
    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
933 937

	
934 938
    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
935 939
    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
936 940

	
937 941
    typedef False NodeNumTag;
942
    typedef False ArcNumTag;
938 943
    typedef False EdgeNumTag;
939 944

	
940
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
945
    typedef FindArcTagIndicator<Graph> FindArcTag;
941 946
    Arc findArc(const Node& u, const Node& v,
942 947
                const Arc& prev = INVALID) {
943 948
      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
944 949
        return INVALID;
945 950
      }
946 951
      Arc arc = Parent::findArc(u, v, prev);
947 952
      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
948 953
        arc = Parent::findArc(u, v, arc);
949 954
      }
950 955
      return arc;
951 956
    }
957

	
958
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
952 959
    Edge findEdge(const Node& u, const Node& v,
953 960
                  const Edge& prev = INVALID) {
954 961
      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
955 962
        return INVALID;
956 963
      }
957 964
      Edge edge = Parent::findEdge(u, v, prev);
958 965
      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
959 966
        edge = Parent::findEdge(u, v, edge);
960 967
      }
961 968
      return edge;
962 969
    }
963 970

	
964 971
    template <typename _Value>
965 972
    class NodeMap : public SubMapExtender<Adaptor,
966 973
      typename Parent::template NodeMap<_Value> > {
967 974
    public:
968 975
      typedef _Value Value;
969 976
      typedef SubMapExtender<Adaptor, typename Parent::
970 977
                             template NodeMap<Value> > MapParent;
971 978

	
972 979
      NodeMap(const Adaptor& adaptor)
973 980
        : MapParent(adaptor) {}
974 981
      NodeMap(const Adaptor& adaptor, const Value& value)
975 982
        : MapParent(adaptor, value) {}
... ...
@@ -1110,59 +1117,62 @@
1110 1117
    void nextIn(Arc& i) const {
1111 1118
      Parent::nextIn(i);
1112 1119
      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i);
1113 1120
    }
1114 1121

	
1115 1122
    void nextOut(Arc& i) const {
1116 1123
      Parent::nextOut(i);
1117 1124
      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i);
1118 1125
    }
1119 1126
    void nextInc(Edge& i, bool& d) const {
1120 1127
      Parent::nextInc(i, d);
1121 1128
      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
1122 1129
    }
1123 1130

	
1124 1131
    void hide(const Node& n) const { _node_filter_map->set(n, false); }
1125 1132
    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
1126 1133

	
1127 1134
    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
1128 1135
    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
1129 1136

	
1130 1137
    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
1131 1138
    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
1132 1139

	
1133 1140
    typedef False NodeNumTag;
1141
    typedef False ArcNumTag;
1134 1142
    typedef False EdgeNumTag;
1135 1143

	
1136
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
1144
    typedef FindArcTagIndicator<Graph> FindArcTag;
1137 1145
    Arc findArc(const Node& u, const Node& v,
1138 1146
                const Arc& prev = INVALID) {
1139 1147
      Arc arc = Parent::findArc(u, v, prev);
1140 1148
      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
1141 1149
        arc = Parent::findArc(u, v, arc);
1142 1150
      }
1143 1151
      return arc;
1144 1152
    }
1153

	
1154
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
1145 1155
    Edge findEdge(const Node& u, const Node& v,
1146 1156
                  const Edge& prev = INVALID) {
1147 1157
      Edge edge = Parent::findEdge(u, v, prev);
1148 1158
      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
1149 1159
        edge = Parent::findEdge(u, v, edge);
1150 1160
      }
1151 1161
      return edge;
1152 1162
    }
1153 1163

	
1154 1164
    template <typename _Value>
1155 1165
    class NodeMap : public SubMapExtender<Adaptor,
1156 1166
      typename Parent::template NodeMap<_Value> > {
1157 1167
    public:
1158 1168
      typedef _Value Value;
1159 1169
      typedef SubMapExtender<Adaptor, typename Parent::
1160 1170
                             template NodeMap<Value> > MapParent;
1161 1171

	
1162 1172
      NodeMap(const Adaptor& adaptor)
1163 1173
        : MapParent(adaptor) {}
1164 1174
      NodeMap(const Adaptor& adaptor, const Value& value)
1165 1175
        : MapParent(adaptor, value) {}
1166 1176

	
1167 1177
    private:
1168 1178
      NodeMap& operator=(const NodeMap& cmap) {
... ...
@@ -1825,71 +1835,75 @@
1825 1835
    Edge edgeFromId(int ix) const { return _digraph->arcFromId(ix); }
1826 1836

	
1827 1837
    int id(const Node &n) const { return _digraph->id(n); }
1828 1838
    int id(const Arc &a) const {
1829 1839
      return  (_digraph->id(a) << 1) | (a._forward ? 1 : 0);
1830 1840
    }
1831 1841
    int id(const Edge &e) const { return _digraph->id(e); }
1832 1842

	
1833 1843
    int maxNodeId() const { return _digraph->maxNodeId(); }
1834 1844
    int maxArcId() const { return (_digraph->maxArcId() << 1) | 1; }
1835 1845
    int maxEdgeId() const { return _digraph->maxArcId(); }
1836 1846

	
1837 1847
    Node addNode() { return _digraph->addNode(); }
1838 1848
    Edge addEdge(const Node& u, const Node& v) {
1839 1849
      return _digraph->addArc(u, v);
1840 1850
    }
1841 1851

	
1842 1852
    void erase(const Node& i) { _digraph->erase(i); }
1843 1853
    void erase(const Edge& i) { _digraph->erase(i); }
1844 1854

	
1845 1855
    void clear() { _digraph->clear(); }
1846 1856

	
1847 1857
    typedef NodeNumTagIndicator<Digraph> NodeNumTag;
1848 1858
    int nodeNum() const { return 2 * _digraph->arcNum(); }
1849
    typedef EdgeNumTagIndicator<Digraph> EdgeNumTag;
1859

	
1860
    typedef ArcNumTagIndicator<Digraph> ArcNumTag;
1850 1861
    int arcNum() const { return 2 * _digraph->arcNum(); }
1862

	
1863
    typedef ArcNumTag EdgeNumTag;
1851 1864
    int edgeNum() const { return _digraph->arcNum(); }
1852 1865

	
1853
    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
1866
    typedef FindArcTagIndicator<Digraph> FindArcTag;
1854 1867
    Arc findArc(Node s, Node t, Arc p = INVALID) const {
1855 1868
      if (p == INVALID) {
1856 1869
        Edge arc = _digraph->findArc(s, t);
1857 1870
        if (arc != INVALID) return direct(arc, true);
1858 1871
        arc = _digraph->findArc(t, s);
1859 1872
        if (arc != INVALID) return direct(arc, false);
1860 1873
      } else if (direction(p)) {
1861 1874
        Edge arc = _digraph->findArc(s, t, p);
1862 1875
        if (arc != INVALID) return direct(arc, true);
1863 1876
        arc = _digraph->findArc(t, s);
1864 1877
        if (arc != INVALID) return direct(arc, false);
1865 1878
      } else {
1866 1879
        Edge arc = _digraph->findArc(t, s, p);
1867 1880
        if (arc != INVALID) return direct(arc, false);
1868 1881
      }
1869 1882
      return INVALID;
1870 1883
    }
1871 1884

	
1885
    typedef FindArcTag FindEdgeTag;
1872 1886
    Edge findEdge(Node s, Node t, Edge p = INVALID) const {
1873 1887
      if (s != t) {
1874 1888
        if (p == INVALID) {
1875 1889
          Edge arc = _digraph->findArc(s, t);
1876 1890
          if (arc != INVALID) return arc;
1877 1891
          arc = _digraph->findArc(t, s);
1878 1892
          if (arc != INVALID) return arc;
1879 1893
        } else if (_digraph->s(p) == s) {
1880 1894
          Edge arc = _digraph->findArc(s, t, p);
1881 1895
          if (arc != INVALID) return arc;
1882 1896
          arc = _digraph->findArc(t, s);
1883 1897
          if (arc != INVALID) return arc;
1884 1898
        } else {
1885 1899
          Edge arc = _digraph->findArc(t, s, p);
1886 1900
          if (arc != INVALID) return arc;
1887 1901
        }
1888 1902
      } else {
1889 1903
        return _digraph->findArc(s, t, p);
1890 1904
      }
1891 1905
      return INVALID;
1892 1906
    }
1893 1907

	
1894 1908
  private:
1895 1909

	
... ...
@@ -2203,52 +2217,52 @@
2203 2217

	
2204 2218
    void next(Node& i) const { _graph->next(i); }
2205 2219
    void next(Arc& i) const { _graph->next(i); }
2206 2220
    void nextIn(Arc& i) const {
2207 2221
      bool d = !(*_direction)[i];
2208 2222
      _graph->nextInc(i, d);
2209 2223
      while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
2210 2224
    }
2211 2225
    void nextOut(Arc& i) const {
2212 2226
      bool d = (*_direction)[i];
2213 2227
      _graph->nextInc(i, d);
2214 2228
      while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
2215 2229
    }
2216 2230

	
2217 2231
    Node source(const Arc& e) const {
2218 2232
      return (*_direction)[e] ? _graph->u(e) : _graph->v(e);
2219 2233
    }
2220 2234
    Node target(const Arc& e) const {
2221 2235
      return (*_direction)[e] ? _graph->v(e) : _graph->u(e);
2222 2236
    }
2223 2237

	
2224 2238
    typedef NodeNumTagIndicator<Graph> NodeNumTag;
2225 2239
    int nodeNum() const { return _graph->nodeNum(); }
2226 2240

	
2227
    typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
2241
    typedef EdgeNumTagIndicator<Graph> ArcNumTag;
2228 2242
    int arcNum() const { return _graph->edgeNum(); }
2229 2243

	
2230
    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
2244
    typedef FindEdgeTagIndicator<Graph> FindArcTag;
2231 2245
    Arc findArc(const Node& u, const Node& v,
2232 2246
                const Arc& prev = INVALID) {
2233 2247
      Arc arc = prev;
2234 2248
      bool d = arc == INVALID ? true : (*_direction)[arc];
2235 2249
      if (d) {
2236 2250
        arc = _graph->findEdge(u, v, arc);
2237 2251
        while (arc != INVALID && !(*_direction)[arc]) {
2238 2252
          _graph->findEdge(u, v, arc);
2239 2253
        }
2240 2254
        if (arc != INVALID) return arc;
2241 2255
      }
2242 2256
      _graph->findEdge(v, u, arc);
2243 2257
      while (arc != INVALID && (*_direction)[arc]) {
2244 2258
        _graph->findEdge(u, v, arc);
2245 2259
      }
2246 2260
      return arc;
2247 2261
    }
2248 2262

	
2249 2263
    Node addNode() {
2250 2264
      return Node(_graph->addNode());
2251 2265
    }
2252 2266

	
2253 2267
    Arc addArc(const Node& u, const Node& v) {
2254 2268
      Arc arc = _graph->addArc(u, v);
... ...
@@ -2863,59 +2877,58 @@
2863 2877
      return e._item.firstState();
2864 2878
    }
2865 2879

	
2866 2880
    static bool bindArc(const Arc& e) {
2867 2881
      return e._item.secondState();
2868 2882
    }
2869 2883

	
2870 2884
    static Node inNode(const DigraphNode& n) {
2871 2885
      return Node(n, true);
2872 2886
    }
2873 2887

	
2874 2888
    static Node outNode(const DigraphNode& n) {
2875 2889
      return Node(n, false);
2876 2890
    }
2877 2891

	
2878 2892
    static Arc arc(const DigraphNode& n) {
2879 2893
      return Arc(n);
2880 2894
    }
2881 2895

	
2882 2896
    static Arc arc(const DigraphArc& e) {
2883 2897
      return Arc(e);
2884 2898
    }
2885 2899

	
2886 2900
    typedef True NodeNumTag;
2887

	
2888 2901
    int nodeNum() const {
2889 2902
      return  2 * countNodes(*_digraph);
2890 2903
    }
2891 2904

	
2892
    typedef True EdgeNumTag;
2905
    typedef True ArcNumTag;
2893 2906
    int arcNum() const {
2894 2907
      return countArcs(*_digraph) + countNodes(*_digraph);
2895 2908
    }
2896 2909

	
2897
    typedef True FindEdgeTag;
2910
    typedef True FindArcTag;
2898 2911
    Arc findArc(const Node& u, const Node& v,
2899 2912
                const Arc& prev = INVALID) const {
2900 2913
      if (inNode(u)) {
2901 2914
        if (outNode(v)) {
2902 2915
          if (static_cast<const DigraphNode&>(u) ==
2903 2916
              static_cast<const DigraphNode&>(v) && prev == INVALID) {
2904 2917
            return Arc(u);
2905 2918
          }
2906 2919
        }
2907 2920
      } else {
2908 2921
        if (inNode(v)) {
2909 2922
          return Arc(::lemon::findArc(*_digraph, u, v, prev));
2910 2923
        }
2911 2924
      }
2912 2925
      return INVALID;
2913 2926
    }
2914 2927

	
2915 2928
  private:
2916 2929

	
2917 2930
    template <typename _Value>
2918 2931
    class NodeMapBase
2919 2932
      : public MapTraits<typename Parent::template NodeMap<_Value> > {
2920 2933
      typedef typename Parent::template NodeMap<_Value> NodeImpl;
2921 2934
    public:
0 comments (0 inline)