COIN-OR::LEMON - Graph Library

Changeset 1054:6a62b1b4cf23 in lemon-0.x for src


Ignore:
Timestamp:
01/05/05 17:59:50 (16 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1448
Message:

countUndirEdges bugs fixed

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/undir_graph_extender.h

    r1053 r1054  
    238238    }
    239239
     240
     241    int edgeNum() const {
     242      return 2 * Parent::edgeNum();
     243    }
     244    int undirEdgeNum() const {
     245      return Parent::edgeNum();
     246    }
     247
    240248  };
    241249
  • src/test/undir_graph_test.cc

    r1053 r1054  
    4444}
    4545
    46 typedef UndirListGraph Graph;
    47 typedef Graph::Node Node;
    48 typedef Graph::UndirEdge UEdge;
    49 typedef Graph::Edge Edge;
    50 typedef Graph::NodeIt NodeIt;
    51 typedef Graph::UndirEdgeIt UEdgeIt;
    52 typedef Graph::EdgeIt EdgeIt;
    53 
     46template <typename Graph>
    5447void check_item_counts(Graph &g, int n, int e) {
    5548  check(countNodes(g)==n, "Wrong node number.");
     
    5750}
    5851
     52template <typename Graph>
    5953void print_items(Graph &g) {
     54
     55  typedef typename Graph::NodeIt NodeIt;
     56  typedef typename Graph::UndirEdgeIt UEdgeIt;
     57  typedef typename Graph::EdgeIt EdgeIt;
     58
    6059  cout << "Nodes" << endl;
    6160  int i=0;
     
    8281}
    8382
    84 int main() {
    85   check_concepts();
     83template <typename Graph>
     84void check_graph() {
    8685
     86  typedef typename Graph::Node Node;
     87  typedef typename Graph::UndirEdge UEdge;
     88  typedef typename Graph::Edge Edge;
     89  typedef typename Graph::NodeIt NodeIt;
     90  typedef typename Graph::UndirEdgeIt UEdgeIt;
     91  typedef typename Graph::EdgeIt EdgeIt;
    8792
    8893  Graph g;
     
    103108  check_item_counts(g,3,2);
    104109
     110
     111}
     112
     113int main() {
     114  check_concepts();
     115
     116  check_graph<UndirListGraph>();
     117  check_graph<UndirSmartGraph>();
     118
    105119  return 0;
    106120}
Note: See TracChangeset for help on using the changeset viewer.