Make some graph member functions static (#311, #68)
authorPeter Kovacs <kpeter@inf.elte.hu>
Tue, 29 Sep 2009 13:03:34 +0200
changeset 778a143f19f465b
parent 776 eff1caf6d32e
child 779 c160bf9f18ef
Make some graph member functions static (#311, #68)
lemon/bits/graph_extender.h
lemon/edge_set.h
lemon/full_graph.h
lemon/hypercube_graph.h
lemon/smart_graph.h
lemon/static_graph.h
     1.1 --- a/lemon/bits/graph_extender.h	Tue Sep 29 10:39:20 2009 +0200
     1.2 +++ b/lemon/bits/graph_extender.h	Tue Sep 29 13:03:34 2009 +0200
     1.3 @@ -56,11 +56,11 @@
     1.4        return Parent::maxArcId();
     1.5      }
     1.6  
     1.7 -    Node fromId(int id, Node) const {
     1.8 +    static Node fromId(int id, Node) {
     1.9        return Parent::nodeFromId(id);
    1.10      }
    1.11  
    1.12 -    Arc fromId(int id, Arc) const {
    1.13 +    static Arc fromId(int id, Arc) {
    1.14        return Parent::arcFromId(id);
    1.15      }
    1.16  
    1.17 @@ -355,15 +355,15 @@
    1.18        return Parent::maxEdgeId();
    1.19      }
    1.20  
    1.21 -    Node fromId(int id, Node) const {
    1.22 +    static Node fromId(int id, Node) {
    1.23        return Parent::nodeFromId(id);
    1.24      }
    1.25  
    1.26 -    Arc fromId(int id, Arc) const {
    1.27 +    static Arc fromId(int id, Arc) {
    1.28        return Parent::arcFromId(id);
    1.29      }
    1.30  
    1.31 -    Edge fromId(int id, Edge) const {
    1.32 +    static Edge fromId(int id, Edge) {
    1.33        return Parent::edgeFromId(id);
    1.34      }
    1.35  
     2.1 --- a/lemon/edge_set.h	Tue Sep 29 10:39:20 2009 +0200
     2.2 +++ b/lemon/edge_set.h	Tue Sep 29 13:03:34 2009 +0200
     2.3 @@ -867,7 +867,7 @@
     2.4        arc.id = arcs.size() - 1;
     2.5      }
     2.6  
     2.7 -    void next(Arc& arc) const {
     2.8 +    static void next(Arc& arc) {
     2.9        --arc.id;
    2.10      }
    2.11  
    2.12 @@ -1173,7 +1173,7 @@
    2.13        arc.id = arcs.size() - 1;
    2.14      }
    2.15  
    2.16 -    void next(Arc& arc) const {
    2.17 +    static void next(Arc& arc) {
    2.18        --arc.id;
    2.19      }
    2.20  
    2.21 @@ -1181,7 +1181,7 @@
    2.22        arc.id = arcs.size() / 2 - 1;
    2.23      }
    2.24  
    2.25 -    void next(Edge& arc) const {
    2.26 +    static void next(Edge& arc) {
    2.27        --arc.id;
    2.28      }
    2.29  
     3.1 --- a/lemon/full_graph.h	Tue Sep 29 10:39:20 2009 +0200
     3.2 +++ b/lemon/full_graph.h	Tue Sep 29 13:03:34 2009 +0200
     3.3 @@ -51,7 +51,7 @@
     3.4      typedef True ArcNumTag;
     3.5  
     3.6      Node operator()(int ix) const { return Node(ix); }
     3.7 -    int index(const Node& node) const { return node._id; }
     3.8 +    static int index(const Node& node) { return node._id; }
     3.9  
    3.10      Arc arc(const Node& s, const Node& t) const {
    3.11        return Arc(s._id * _node_num + t._id);
    3.12 @@ -209,7 +209,7 @@
    3.13      /// digraph its nodes can be indexed with integers from the range
    3.14      /// <tt>[0..nodeNum()-1]</tt>.
    3.15      /// \sa operator()
    3.16 -    int index(const Node& node) const { return Parent::index(node); }
    3.17 +    static int index(const Node& node) { return Parent::index(node); }
    3.18  
    3.19      /// \brief Returns the arc connecting the given nodes.
    3.20      ///
    3.21 @@ -283,7 +283,7 @@
    3.22    public:
    3.23  
    3.24      Node operator()(int ix) const { return Node(ix); }
    3.25 -    int index(const Node& node) const { return node._id; }
    3.26 +    static int index(const Node& node) { return node._id; }
    3.27  
    3.28      Edge edge(const Node& u, const Node& v) const {
    3.29        if (u._id < v._id) {
    3.30 @@ -580,7 +580,7 @@
    3.31      /// graph its nodes can be indexed with integers from the range
    3.32      /// <tt>[0..nodeNum()-1]</tt>.
    3.33      /// \sa operator()
    3.34 -    int index(const Node& node) const { return Parent::index(node); }
    3.35 +    static int index(const Node& node) { return Parent::index(node); }
    3.36  
    3.37      /// \brief Returns the arc connecting the given nodes.
    3.38      ///
     4.1 --- a/lemon/hypercube_graph.h	Tue Sep 29 10:39:20 2009 +0200
     4.2 +++ b/lemon/hypercube_graph.h	Tue Sep 29 13:03:34 2009 +0200
     4.3 @@ -262,7 +262,7 @@
     4.4        return arc._id >> _dim;
     4.5      }
     4.6  
     4.7 -    int index(Node node) const {
     4.8 +    static int index(Node node) {
     4.9        return node._id;
    4.10      }
    4.11  
    4.12 @@ -337,7 +337,7 @@
    4.13      ///
    4.14      /// Gives back the index of the given node.
    4.15      /// The lower bits of the integer describes the node.
    4.16 -    int index(Node node) const {
    4.17 +    static int index(Node node) {
    4.18        return Parent::index(node);
    4.19      }
    4.20  
     5.1 --- a/lemon/smart_graph.h	Tue Sep 29 10:39:20 2009 +0200
     5.2 +++ b/lemon/smart_graph.h	Tue Sep 29 13:03:34 2009 +0200
     5.3 @@ -508,7 +508,7 @@
     5.4        node._id = nodes.size() - 1;
     5.5      }
     5.6  
     5.7 -    void next(Node& node) const {
     5.8 +    static void next(Node& node) {
     5.9        --node._id;
    5.10      }
    5.11  
    5.12 @@ -516,7 +516,7 @@
    5.13        arc._id = arcs.size() - 1;
    5.14      }
    5.15  
    5.16 -    void next(Arc& arc) const {
    5.17 +    static void next(Arc& arc) {
    5.18        --arc._id;
    5.19      }
    5.20  
    5.21 @@ -524,7 +524,7 @@
    5.22        arc._id = arcs.size() / 2 - 1;
    5.23      }
    5.24  
    5.25 -    void next(Edge& arc) const {
    5.26 +    static void next(Edge& arc) {
    5.27        --arc._id;
    5.28      }
    5.29  
     6.1 --- a/lemon/static_graph.h	Tue Sep 29 10:39:20 2009 +0200
     6.2 +++ b/lemon/static_graph.h	Tue Sep 29 13:03:34 2009 +0200
     6.3 @@ -92,12 +92,12 @@
     6.4      void firstIn(Arc& e, const Node& n) const { e.id = node_first_in[n.id]; }
     6.5      void nextIn(Arc& e) const { e.id = arc_next_in[e.id]; }
     6.6  
     6.7 -    int id(const Node& n) const { return n.id; }
     6.8 -    Node nodeFromId(int id) const { return Node(id); }
     6.9 +    static int id(const Node& n) { return n.id; }
    6.10 +    static Node nodeFromId(int id) { return Node(id); }
    6.11      int maxNodeId() const { return node_num - 1; }
    6.12  
    6.13 -    int id(const Arc& e) const { return e.id; }
    6.14 -    Arc arcFromId(int id) const { return Arc(id); }
    6.15 +    static int id(const Arc& e) { return e.id; }
    6.16 +    static Arc arcFromId(int id) { return Arc(id); }
    6.17      int maxArcId() const { return arc_num - 1; }
    6.18  
    6.19      typedef True NodeNumTag;
    6.20 @@ -268,25 +268,25 @@
    6.21      ///
    6.22      /// This function returns the node with the given index.
    6.23      /// \sa index()
    6.24 -    Node node(int ix) const { return Parent::nodeFromId(ix); }
    6.25 +    static Node node(int ix) { return Parent::nodeFromId(ix); }
    6.26  
    6.27      /// \brief The arc with the given index.
    6.28      ///
    6.29      /// This function returns the arc with the given index.
    6.30      /// \sa index()
    6.31 -    Arc arc(int ix) const { return Parent::arcFromId(ix); }
    6.32 +    static Arc arc(int ix) { return Parent::arcFromId(ix); }
    6.33  
    6.34      /// \brief The index of the given node.
    6.35      ///
    6.36      /// This function returns the index of the the given node.
    6.37      /// \sa node()
    6.38 -    int index(Node node) const { return Parent::id(node); }
    6.39 +    static int index(Node node) { return Parent::id(node); }
    6.40  
    6.41      /// \brief The index of the given arc.
    6.42      ///
    6.43      /// This function returns the index of the the given arc.
    6.44      /// \sa arc()
    6.45 -    int index(Arc arc) const { return Parent::id(arc); }
    6.46 +    static int index(Arc arc) { return Parent::id(arc); }
    6.47  
    6.48      /// \brief Number of nodes.
    6.49      ///