# HG changeset patch # User marci # Date 1084177510 0 # Node ID b83b36ee7f10b027e0dd3e9f0f68d09e22ee7c60 # Parent 5961cce7ec5370b5b5cb0c0735eaffcb6c4aa9af comleteGraph diff -r 5961cce7ec53 -r b83b36ee7f10 src/hugo/graph_wrapper.h --- a/src/hugo/graph_wrapper.h Sun May 09 16:29:53 2004 +0000 +++ b/src/hugo/graph_wrapper.h Mon May 10 08:25:10 2004 +0000 @@ -465,6 +465,25 @@ /// Returns true if \c n is hidden. bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; } + + /// This is a linear time operation an works only if + /// NodeIt is defined. + int nodeNum() const { + int i=0; + NodeIt n; + for (this->first(n); this->valid(n); this->next(n)) ++i; + return i; + } + + /// This is a linear time operation and works only if + /// EdgeIt is defined. + int edgeNum() const { + int i=0; + EdgeIt e; + for (this->first(e); this->valid(e); this->next(e)) ++i; + return i; + } + }; @@ -1318,6 +1337,5 @@ } //namespace hugo - #endif //HUGO_GRAPH_WRAPPER_H diff -r 5961cce7ec53 -r b83b36ee7f10 src/work/jacint/graph_gen.h --- a/src/work/jacint/graph_gen.h Sun May 09 16:29:53 2004 +0000 +++ b/src/work/jacint/graph_gen.h Mon May 10 08:25:10 2004 +0000 @@ -61,4 +61,18 @@ g.addEdge(s_nodes[random(a)], t_nodes[random(b)]); } + /// Generates a complete graph in the undirected sense + /// with n nodes and m edges. + /// Before generating the random graph, \c g.clear() is called. + template + void completeGraph(Graph& g, int n) { + g.clear(); + std::vector nodes; + for (int i=0; i