COIN-OR::LEMON - Graph Library

Ticket #68: 68-311-static-a143f19f465b.patch

File 68-311-static-a143f19f465b.patch, 6.0 KB (added by Peter Kovacs, 15 years ago)
  • lemon/bits/graph_extender.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1254222214 -7200
    # 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 b  
    5656      return Parent::maxArcId();
    5757    }
    5858
    59     Node fromId(int id, Node) const {
     59    static Node fromId(int id, Node) {
    6060      return Parent::nodeFromId(id);
    6161    }
    6262
    63     Arc fromId(int id, Arc) const {
     63    static Arc fromId(int id, Arc) {
    6464      return Parent::arcFromId(id);
    6565    }
    6666
     
    355355      return Parent::maxEdgeId();
    356356    }
    357357
    358     Node fromId(int id, Node) const {
     358    static Node fromId(int id, Node) {
    359359      return Parent::nodeFromId(id);
    360360    }
    361361
    362     Arc fromId(int id, Arc) const {
     362    static Arc fromId(int id, Arc) {
    363363      return Parent::arcFromId(id);
    364364    }
    365365
    366     Edge fromId(int id, Edge) const {
     366    static Edge fromId(int id, Edge) {
    367367      return Parent::edgeFromId(id);
    368368    }
    369369
  • lemon/edge_set.h

    diff --git a/lemon/edge_set.h b/lemon/edge_set.h
    a b  
    867867      arc.id = arcs.size() - 1;
    868868    }
    869869
    870     void next(Arc& arc) const {
     870    static void next(Arc& arc) {
    871871      --arc.id;
    872872    }
    873873
     
    11731173      arc.id = arcs.size() - 1;
    11741174    }
    11751175
    1176     void next(Arc& arc) const {
     1176    static void next(Arc& arc) {
    11771177      --arc.id;
    11781178    }
    11791179
     
    11811181      arc.id = arcs.size() / 2 - 1;
    11821182    }
    11831183
    1184     void next(Edge& arc) const {
     1184    static void next(Edge& arc) {
    11851185      --arc.id;
    11861186    }
    11871187
  • lemon/full_graph.h

    diff --git a/lemon/full_graph.h b/lemon/full_graph.h
    a b  
    5151    typedef True ArcNumTag;
    5252
    5353    Node operator()(int ix) const { return Node(ix); }
    54     int index(const Node& node) const { return node._id; }
     54    static int index(const Node& node) { return node._id; }
    5555
    5656    Arc arc(const Node& s, const Node& t) const {
    5757      return Arc(s._id * _node_num + t._id);
     
    209209    /// digraph its nodes can be indexed with integers from the range
    210210    /// <tt>[0..nodeNum()-1]</tt>.
    211211    /// \sa operator()
    212     int index(const Node& node) const { return Parent::index(node); }
     212    static int index(const Node& node) { return Parent::index(node); }
    213213
    214214    /// \brief Returns the arc connecting the given nodes.
    215215    ///
     
    283283  public:
    284284
    285285    Node operator()(int ix) const { return Node(ix); }
    286     int index(const Node& node) const { return node._id; }
     286    static int index(const Node& node) { return node._id; }
    287287
    288288    Edge edge(const Node& u, const Node& v) const {
    289289      if (u._id < v._id) {
     
    580580    /// graph its nodes can be indexed with integers from the range
    581581    /// <tt>[0..nodeNum()-1]</tt>.
    582582    /// \sa operator()
    583     int index(const Node& node) const { return Parent::index(node); }
     583    static int index(const Node& node) { return Parent::index(node); }
    584584
    585585    /// \brief Returns the arc connecting the given nodes.
    586586    ///
  • lemon/hypercube_graph.h

    diff --git a/lemon/hypercube_graph.h b/lemon/hypercube_graph.h
    a b  
    262262      return arc._id >> _dim;
    263263    }
    264264
    265     int index(Node node) const {
     265    static int index(Node node) {
    266266      return node._id;
    267267    }
    268268
     
    337337    ///
    338338    /// Gives back the index of the given node.
    339339    /// The lower bits of the integer describes the node.
    340     int index(Node node) const {
     340    static int index(Node node) {
    341341      return Parent::index(node);
    342342    }
    343343
  • lemon/smart_graph.h

    diff --git a/lemon/smart_graph.h b/lemon/smart_graph.h
    a b  
    508508      node._id = nodes.size() - 1;
    509509    }
    510510
    511     void next(Node& node) const {
     511    static void next(Node& node) {
    512512      --node._id;
    513513    }
    514514
     
    516516      arc._id = arcs.size() - 1;
    517517    }
    518518
    519     void next(Arc& arc) const {
     519    static void next(Arc& arc) {
    520520      --arc._id;
    521521    }
    522522
     
    524524      arc._id = arcs.size() / 2 - 1;
    525525    }
    526526
    527     void next(Edge& arc) const {
     527    static void next(Edge& arc) {
    528528      --arc._id;
    529529    }
    530530
  • lemon/static_graph.h

    diff --git a/lemon/static_graph.h b/lemon/static_graph.h
    a b  
    9292    void firstIn(Arc& e, const Node& n) const { e.id = node_first_in[n.id]; }
    9393    void nextIn(Arc& e) const { e.id = arc_next_in[e.id]; }
    9494
    95     int id(const Node& n) const { return n.id; }
    96     Node nodeFromId(int id) const { return Node(id); }
     95    static int id(const Node& n) { return n.id; }
     96    static Node nodeFromId(int id) { return Node(id); }
    9797    int maxNodeId() const { return node_num - 1; }
    9898
    99     int id(const Arc& e) const { return e.id; }
    100     Arc arcFromId(int id) const { return Arc(id); }
     99    static int id(const Arc& e) { return e.id; }
     100    static Arc arcFromId(int id) { return Arc(id); }
    101101    int maxArcId() const { return arc_num - 1; }
    102102
    103103    typedef True NodeNumTag;
     
    268268    ///
    269269    /// This function returns the node with the given index.
    270270    /// \sa index()
    271     Node node(int ix) const { return Parent::nodeFromId(ix); }
     271    static Node node(int ix) { return Parent::nodeFromId(ix); }
    272272
    273273    /// \brief The arc with the given index.
    274274    ///
    275275    /// This function returns the arc with the given index.
    276276    /// \sa index()
    277     Arc arc(int ix) const { return Parent::arcFromId(ix); }
     277    static Arc arc(int ix) { return Parent::arcFromId(ix); }
    278278
    279279    /// \brief The index of the given node.
    280280    ///
    281281    /// This function returns the index of the the given node.
    282282    /// \sa node()
    283     int index(Node node) const { return Parent::id(node); }
     283    static int index(Node node) { return Parent::id(node); }
    284284
    285285    /// \brief The index of the given arc.
    286286    ///
    287287    /// This function returns the index of the the given arc.
    288288    /// \sa arc()
    289     int index(Arc arc) const { return Parent::id(arc); }
     289    static int index(Arc arc) { return Parent::id(arc); }
    290290
    291291    /// \brief Number of nodes.
    292292    ///