gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Add artificial addNode() function to the arc/edge set classes
0 1 0
default
1 file changed with 24 insertions and 0 deletions:
↑ Collapse diff ↑
Show white space 12 line context
... ...
@@ -81,12 +81,18 @@
81 81
      bool operator!=(const Arc& arc) const { return id != arc.id; }
82 82
      bool operator<(const Arc& arc) const { return id < arc.id; }
83 83
    };
84 84

	
85 85
    ListArcSetBase() : first_arc(-1), first_free_arc(-1) {}
86 86

	
87
    Node addNode() {
88
      LEMON_ASSERT(false,
89
        "This graph structure does not support node insertion");
90
      return INVALID; // avoid warning
91
    }
92

	
87 93
    Arc addArc(const Node& u, const Node& v) {
88 94
      int n;
89 95
      if (first_free_arc == -1) {
90 96
        n = arcs.size();
91 97
        arcs.push_back(ArcT());
92 98
      } else {
... ...
@@ -413,12 +419,18 @@
413 419
      bool operator!=(const Arc& arc) const { return id != arc.id; }
414 420
      bool operator<(const Arc& arc) const { return id < arc.id; }
415 421
    };
416 422

	
417 423
    ListEdgeSetBase() : first_arc(-1), first_free_arc(-1) {}
418 424

	
425
    Node addNode() {
426
      LEMON_ASSERT(false,
427
        "This graph structure does not support node insertion");
428
      return INVALID; // avoid warning
429
    }
430

	
419 431
    Edge addEdge(const Node& u, const Node& v) {
420 432
      int n;
421 433

	
422 434
      if (first_free_arc == -1) {
423 435
        n = arcs.size();
424 436
        arcs.push_back(ArcT());
... ...
@@ -813,12 +825,18 @@
813 825
      bool operator!=(const Arc& arc) const { return id != arc.id; }
814 826
      bool operator<(const Arc& arc) const { return id < arc.id; }
815 827
    };
816 828

	
817 829
    SmartArcSetBase() {}
818 830

	
831
    Node addNode() {
832
      LEMON_ASSERT(false,
833
        "This graph structure does not support node insertion");
834
      return INVALID; // avoid warning
835
    }
836

	
819 837
    Arc addArc(const Node& u, const Node& v) {
820 838
      int n = arcs.size();
821 839
      arcs.push_back(ArcT());
822 840
      arcs[n].next_in = (*_nodes)[v].first_in;
823 841
      (*_nodes)[v].first_in = n;
824 842
      arcs[n].next_out = (*_nodes)[u].first_out;
... ...
@@ -1109,12 +1127,18 @@
1109 1127
      bool operator!=(const Arc& arc) const { return id != arc.id; }
1110 1128
      bool operator<(const Arc& arc) const { return id < arc.id; }
1111 1129
    };
1112 1130

	
1113 1131
    SmartEdgeSetBase() {}
1114 1132

	
1133
    Node addNode() {
1134
      LEMON_ASSERT(false,
1135
        "This graph structure does not support node insertion");
1136
      return INVALID; // avoid warning
1137
    }
1138

	
1115 1139
    Edge addEdge(const Node& u, const Node& v) {
1116 1140
      int n = arcs.size();
1117 1141
      arcs.push_back(ArcT());
1118 1142
      arcs.push_back(ArcT());
1119 1143

	
1120 1144
      arcs[n].target = u;
0 comments (0 inline)