# HG changeset patch # User klao # Date 1104944390 0 # Node ID 6a62b1b4cf2312f654b66a157efafbbe9683cd91 # Parent 90f8696360b2958c45980e5b6ace1f947c56548e countUndirEdges bugs fixed diff -r 90f8696360b2 -r 6a62b1b4cf23 src/lemon/undir_graph_extender.h --- a/src/lemon/undir_graph_extender.h Wed Jan 05 14:34:00 2005 +0000 +++ b/src/lemon/undir_graph_extender.h Wed Jan 05 16:59:50 2005 +0000 @@ -237,6 +237,14 @@ return Parent::maxId(typename Parent::Edge()); } + + int edgeNum() const { + return 2 * Parent::edgeNum(); + } + int undirEdgeNum() const { + return Parent::edgeNum(); + } + }; } diff -r 90f8696360b2 -r 6a62b1b4cf23 src/test/undir_graph_test.cc --- a/src/test/undir_graph_test.cc Wed Jan 05 14:34:00 2005 +0000 +++ b/src/test/undir_graph_test.cc Wed Jan 05 16:59:50 2005 +0000 @@ -43,20 +43,19 @@ checkConcept(); } -typedef UndirListGraph Graph; -typedef Graph::Node Node; -typedef Graph::UndirEdge UEdge; -typedef Graph::Edge Edge; -typedef Graph::NodeIt NodeIt; -typedef Graph::UndirEdgeIt UEdgeIt; -typedef Graph::EdgeIt EdgeIt; - +template void check_item_counts(Graph &g, int n, int e) { check(countNodes(g)==n, "Wrong node number."); check(countEdges(g)==2*e, "Wrong edge number."); } +template void print_items(Graph &g) { + + typedef typename Graph::NodeIt NodeIt; + typedef typename Graph::UndirEdgeIt UEdgeIt; + typedef typename Graph::EdgeIt EdgeIt; + cout << "Nodes" << endl; int i=0; for(NodeIt it(g); it!=INVALID; ++it, ++i) { @@ -81,9 +80,15 @@ } -int main() { - check_concepts(); +template +void check_graph() { + typedef typename Graph::Node Node; + typedef typename Graph::UndirEdge UEdge; + typedef typename Graph::Edge Edge; + typedef typename Graph::NodeIt NodeIt; + typedef typename Graph::UndirEdgeIt UEdgeIt; + typedef typename Graph::EdgeIt EdgeIt; Graph g; @@ -102,5 +107,14 @@ check_item_counts(g,3,2); + +} + +int main() { + check_concepts(); + + check_graph(); + check_graph(); + return 0; }