1.1 --- a/src/hugo/graph_wrapper.h Sun May 09 16:29:53 2004 +0000
1.2 +++ b/src/hugo/graph_wrapper.h Mon May 10 08:25:10 2004 +0000
1.3 @@ -465,6 +465,25 @@
1.4
1.5 /// Returns true if \c n is hidden.
1.6 bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
1.7 +
1.8 + /// This is a linear time operation an works only if
1.9 + /// NodeIt is defined.
1.10 + int nodeNum() const {
1.11 + int i=0;
1.12 + NodeIt n;
1.13 + for (this->first(n); this->valid(n); this->next(n)) ++i;
1.14 + return i;
1.15 + }
1.16 +
1.17 + /// This is a linear time operation and works only if
1.18 + /// EdgeIt is defined.
1.19 + int edgeNum() const {
1.20 + int i=0;
1.21 + EdgeIt e;
1.22 + for (this->first(e); this->valid(e); this->next(e)) ++i;
1.23 + return i;
1.24 + }
1.25 +
1.26 };
1.27
1.28
1.29 @@ -1318,6 +1337,5 @@
1.30
1.31 } //namespace hugo
1.32
1.33 -
1.34 #endif //HUGO_GRAPH_WRAPPER_H
1.35
2.1 --- a/src/work/jacint/graph_gen.h Sun May 09 16:29:53 2004 +0000
2.2 +++ b/src/work/jacint/graph_gen.h Mon May 10 08:25:10 2004 +0000
2.3 @@ -61,4 +61,18 @@
2.4 g.addEdge(s_nodes[random(a)], t_nodes[random(b)]);
2.5 }
2.6
2.7 + /// Generates a complete graph in the undirected sense
2.8 + /// with n nodes and m edges.
2.9 + /// Before generating the random graph, \c g.clear() is called.
2.10 + template<typename Graph>
2.11 + void completeGraph(Graph& g, int n) {
2.12 + g.clear();
2.13 + std::vector<typename Graph::Node> nodes;
2.14 + for (int i=0; i<n; ++i)
2.15 + nodes.push_back(g.addNode());
2.16 + for (int i=0; i<n; ++i)
2.17 + for (int j=i+1; j<n; ++j)
2.18 + g.addEdge(nodes[i], nodes[j]);
2.19 + }
2.20 +
2.21 } //namespace hugo