# HG changeset patch # User Peter Kovacs # Date 2009-09-29 13:03:34 # Node ID a143f19f465b1334a8dab7067f266f4798b76f3b # Parent eff1caf6d32e2d57692d0b9397e611dac1324f0c Make some graph member functions static (#311, #68) diff --git a/lemon/bits/graph_extender.h b/lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h +++ b/lemon/bits/graph_extender.h @@ -56,11 +56,11 @@ return Parent::maxArcId(); } - 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); } @@ -355,15 +355,15 @@ return Parent::maxEdgeId(); } - 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); } diff --git a/lemon/edge_set.h b/lemon/edge_set.h --- a/lemon/edge_set.h +++ b/lemon/edge_set.h @@ -867,7 +867,7 @@ arc.id = arcs.size() - 1; } - void next(Arc& arc) const { + static void next(Arc& arc) { --arc.id; } @@ -1173,7 +1173,7 @@ arc.id = arcs.size() - 1; } - void next(Arc& arc) const { + static void next(Arc& arc) { --arc.id; } @@ -1181,7 +1181,7 @@ arc.id = arcs.size() / 2 - 1; } - void next(Edge& arc) const { + static void next(Edge& arc) { --arc.id; } diff --git a/lemon/full_graph.h b/lemon/full_graph.h --- a/lemon/full_graph.h +++ b/lemon/full_graph.h @@ -51,7 +51,7 @@ typedef True ArcNumTag; 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 { return Arc(s._id * _node_num + t._id); @@ -209,7 +209,7 @@ /// digraph its nodes can be indexed with integers from the range /// [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. /// @@ -283,7 +283,7 @@ public: 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 { if (u._id < v._id) { @@ -580,7 +580,7 @@ /// graph its nodes can be indexed with integers from the range /// [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. /// diff --git a/lemon/hypercube_graph.h b/lemon/hypercube_graph.h --- a/lemon/hypercube_graph.h +++ b/lemon/hypercube_graph.h @@ -262,7 +262,7 @@ return arc._id >> _dim; } - int index(Node node) const { + static int index(Node node) { return node._id; } @@ -337,7 +337,7 @@ /// /// 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); } diff --git a/lemon/smart_graph.h b/lemon/smart_graph.h --- a/lemon/smart_graph.h +++ b/lemon/smart_graph.h @@ -508,7 +508,7 @@ node._id = nodes.size() - 1; } - void next(Node& node) const { + static void next(Node& node) { --node._id; } @@ -516,7 +516,7 @@ arc._id = arcs.size() - 1; } - void next(Arc& arc) const { + static void next(Arc& arc) { --arc._id; } @@ -524,7 +524,7 @@ arc._id = arcs.size() / 2 - 1; } - void next(Edge& arc) const { + static void next(Edge& arc) { --arc._id; } diff --git a/lemon/static_graph.h b/lemon/static_graph.h --- a/lemon/static_graph.h +++ b/lemon/static_graph.h @@ -92,12 +92,12 @@ void firstIn(Arc& e, const Node& n) const { e.id = node_first_in[n.id]; } 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; } typedef True NodeNumTag; @@ -268,25 +268,25 @@ /// /// 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. /// /// 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. /// /// 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. /// /// 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. ///