Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h (revision 732)
+++ lemon/bits/graph_extender.h (revision 825)
@@ -57,9 +57,9 @@
}
- Node fromId(int id, Node) const {
+ static Node fromId(int id, Node) {
return Parent::nodeFromId(id);
}
- Arc fromId(int id, Arc) const {
+ static Arc fromId(int id, Arc) {
return Parent::arcFromId(id);
}
@@ -356,13 +356,13 @@
}
- Node fromId(int id, Node) const {
+ static Node fromId(int id, Node) {
return Parent::nodeFromId(id);
}
- Arc fromId(int id, Arc) const {
+ static Arc fromId(int id, Arc) {
return Parent::arcFromId(id);
}
- Edge fromId(int id, Edge) const {
+ static Edge fromId(int id, Edge) {
return Parent::edgeFromId(id);
}
Index: lemon/edge_set.h
===================================================================
--- lemon/edge_set.h (revision 717)
+++ lemon/edge_set.h (revision 825)
@@ -868,5 +868,5 @@
}
- void next(Arc& arc) const {
+ static void next(Arc& arc) {
--arc.id;
}
@@ -1174,5 +1174,5 @@
}
- void next(Arc& arc) const {
+ static void next(Arc& arc) {
--arc.id;
}
@@ -1182,5 +1182,5 @@
}
- void next(Edge& arc) const {
+ static void next(Edge& arc) {
--arc.id;
}
Index: lemon/full_graph.h
===================================================================
--- lemon/full_graph.h (revision 664)
+++ lemon/full_graph.h (revision 825)
@@ -52,5 +52,5 @@
Node operator()(int ix) const { return Node(ix); }
- int index(const Node& node) const { return node._id; }
+ static int index(const Node& node) { return node._id; }
Arc arc(const Node& s, const Node& t) const {
@@ -210,5 +210,5 @@
/// [0..nodeNum()-1].
/// \sa operator()
- int index(const Node& node) const { return Parent::index(node); }
+ static int index(const Node& node) { return Parent::index(node); }
/// \brief Returns the arc connecting the given nodes.
@@ -284,5 +284,5 @@
Node operator()(int ix) const { return Node(ix); }
- int index(const Node& node) const { return node._id; }
+ static int index(const Node& node) { return node._id; }
Edge edge(const Node& u, const Node& v) const {
@@ -581,5 +581,5 @@
/// [0..nodeNum()-1].
/// \sa operator()
- int index(const Node& node) const { return Parent::index(node); }
+ static int index(const Node& node) { return Parent::index(node); }
/// \brief Returns the arc connecting the given nodes.
Index: lemon/hypercube_graph.h
===================================================================
--- lemon/hypercube_graph.h (revision 664)
+++ lemon/hypercube_graph.h (revision 825)
@@ -263,5 +263,5 @@
}
- int index(Node node) const {
+ static int index(Node node) {
return node._id;
}
@@ -338,5 +338,5 @@
/// Gives back the index of the given node.
/// The lower bits of the integer describes the node.
- int index(Node node) const {
+ static int index(Node node) {
return Parent::index(node);
}
Index: lemon/smart_graph.h
===================================================================
--- lemon/smart_graph.h (revision 664)
+++ lemon/smart_graph.h (revision 825)
@@ -509,5 +509,5 @@
}
- void next(Node& node) const {
+ static void next(Node& node) {
--node._id;
}
@@ -517,5 +517,5 @@
}
- void next(Arc& arc) const {
+ static void next(Arc& arc) {
--arc._id;
}
@@ -525,5 +525,5 @@
}
- void next(Edge& arc) const {
+ static void next(Edge& arc) {
--arc._id;
}
Index: lemon/static_graph.h
===================================================================
--- lemon/static_graph.h (revision 824)
+++ lemon/static_graph.h (revision 825)
@@ -93,10 +93,10 @@
void nextIn(Arc& e) const { e.id = arc_next_in[e.id]; }
- int id(const Node& n) const { return n.id; }
- Node nodeFromId(int id) const { return Node(id); }
+ static int id(const Node& n) { return n.id; }
+ static Node nodeFromId(int id) { return Node(id); }
int maxNodeId() const { return node_num - 1; }
- int id(const Arc& e) const { return e.id; }
- Arc arcFromId(int id) const { return Arc(id); }
+ static int id(const Arc& e) { return e.id; }
+ static Arc arcFromId(int id) { return Arc(id); }
int maxArcId() const { return arc_num - 1; }
@@ -198,45 +198,4 @@
node_first_out[node_num] = arc_num;
}
-
- template
- void build(int n, ArcListIterator first, ArcListIterator last) {
- built = true;
-
- node_num = n;
- arc_num = std::distance(first, last);
-
- node_first_out = new int[node_num + 1];
- node_first_in = new int[node_num];
-
- arc_source = new int[arc_num];
- arc_target = new int[arc_num];
- arc_next_out = new int[arc_num];
- arc_next_in = new int[arc_num];
-
- for (int i = 0; i != node_num; ++i) {
- node_first_in[i] = -1;
- }
-
- int arc_index = 0;
- for (int i = 0; i != node_num; ++i) {
- node_first_out[i] = arc_index;
- for ( ; first != last && (*first).first == i; ++first) {
- int j = (*first).second;
- LEMON_ASSERT(j >= 0 && j < node_num,
- "Wrong arc list for StaticDigraph::build()");
- arc_source[arc_index] = i;
- arc_target[arc_index] = j;
- arc_next_in[arc_index] = node_first_in[j];
- node_first_in[j] = arc_index;
- arc_next_out[arc_index] = arc_index + 1;
- ++arc_index;
- }
- if (arc_index > node_first_out[i])
- arc_next_out[arc_index - 1] = -1;
- }
- LEMON_ASSERT(first == last,
- "Wrong arc list for StaticDigraph::build()");
- node_first_out[node_num] = arc_num;
- }
protected:
@@ -310,5 +269,5 @@
/// This function returns the node with the given index.
/// \sa index()
- Node node(int ix) const { return Parent::nodeFromId(ix); }
+ static Node node(int ix) { return Parent::nodeFromId(ix); }
/// \brief The arc with the given index.
@@ -316,5 +275,5 @@
/// This function returns the arc with the given index.
/// \sa index()
- Arc arc(int ix) const { return Parent::arcFromId(ix); }
+ static Arc arc(int ix) { return Parent::arcFromId(ix); }
/// \brief The index of the given node.
@@ -322,5 +281,5 @@
/// This function returns the index of the the given node.
/// \sa node()
- int index(Node node) const { return Parent::id(node); }
+ static int index(Node node) { return Parent::id(node); }
/// \brief The index of the given arc.
@@ -328,5 +287,5 @@
/// This function returns the index of the the given arc.
/// \sa arc()
- int index(Arc arc) const { return Parent::id(arc); }
+ static int index(Arc arc) { return Parent::id(arc); }
/// \brief Number of nodes.
@@ -370,42 +329,4 @@
}
- /// \brief Build the digraph from an arc list.
- ///
- /// This function builds the digraph from the given arc list.
- /// It can be called more than once, but in such case, the whole
- /// structure and all maps will be cleared and rebuilt.
- ///
- /// The list of the arcs must be given in the range [begin, end)
- /// specified by STL compatible itartors whose \c value_type must be
- /// std::pair.
- /// Each arc must be specified by a pair of integer indices
- /// from the range [0..n-1]. The pairs must be in a
- /// non-decreasing order with respect to their first values.
- /// If the k-th pair in the list is (i,j), then
- /// arc(k-1) will connect node(i) to node(j).
- ///
- /// \param n The number of nodes.
- /// \param begin An iterator pointing to the beginning of the arc list.
- /// \param end An iterator pointing to the end of the arc list.
- ///
- /// For example, a simple digraph can be constructed like this.
- /// \code
- /// std::vector > arcs;
- /// arcs.push_back(std::make_pair(0,1));
- /// arcs.push_back(std::make_pair(0,2));
- /// arcs.push_back(std::make_pair(1,3));
- /// arcs.push_back(std::make_pair(1,2));
- /// arcs.push_back(std::make_pair(3,0));
- /// StaticDigraph gr;
- /// gr.build(4, arcs.begin(), arcs.end());
- /// \endcode
- template
- void build(int n, ArcListIterator begin, ArcListIterator end) {
- if (built) Parent::clear();
- StaticDigraphBase::build(n, begin, end);
- notifier(Node()).build();
- notifier(Arc()).build();
- }
-
/// \brief Clear the digraph.
///
Index: test/digraph_test.cc
===================================================================
--- test/digraph_test.cc (revision 824)
+++ test/digraph_test.cc (revision 823)
@@ -442,36 +442,4 @@
checkGraphConArcList(G, 4);
- std::vector > arcs;
- arcs.push_back(std::make_pair(0,1));
- arcs.push_back(std::make_pair(0,2));
- arcs.push_back(std::make_pair(1,3));
- arcs.push_back(std::make_pair(1,2));
- arcs.push_back(std::make_pair(3,0));
- arcs.push_back(std::make_pair(3,3));
- arcs.push_back(std::make_pair(4,2));
- arcs.push_back(std::make_pair(4,3));
- arcs.push_back(std::make_pair(4,1));
-
- G.build(6, arcs.begin(), arcs.end());
-
- checkGraphNodeList(G, 6);
- checkGraphArcList(G, 9);
-
- checkGraphOutArcList(G, G.node(0), 2);
- checkGraphOutArcList(G, G.node(1), 2);
- checkGraphOutArcList(G, G.node(2), 0);
- checkGraphOutArcList(G, G.node(3), 2);
- checkGraphOutArcList(G, G.node(4), 3);
- checkGraphOutArcList(G, G.node(5), 0);
-
- checkGraphInArcList(G, G.node(0), 1);
- checkGraphInArcList(G, G.node(1), 2);
- checkGraphInArcList(G, G.node(2), 3);
- checkGraphInArcList(G, G.node(3), 3);
- checkGraphInArcList(G, G.node(4), 0);
- checkGraphInArcList(G, G.node(5), 0);
-
- checkGraphConArcList(G, 9);
-
checkNodeIds(G);
checkArcIds(G);