# 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
|
|
| 56 | 56 | return Parent::maxArcId(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | | Node fromId(int id, Node) const { |
| | 59 | static Node fromId(int id, Node) { |
| 60 | 60 | return Parent::nodeFromId(id); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | | Arc fromId(int id, Arc) const { |
| | 63 | static Arc fromId(int id, Arc) { |
| 64 | 64 | return Parent::arcFromId(id); |
| 65 | 65 | } |
| 66 | 66 | |
| … |
… |
|
| 355 | 355 | return Parent::maxEdgeId(); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | | Node fromId(int id, Node) const { |
| | 358 | static Node fromId(int id, Node) { |
| 359 | 359 | return Parent::nodeFromId(id); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | | Arc fromId(int id, Arc) const { |
| | 362 | static Arc fromId(int id, Arc) { |
| 363 | 363 | return Parent::arcFromId(id); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | | Edge fromId(int id, Edge) const { |
| | 366 | static Edge fromId(int id, Edge) { |
| 367 | 367 | return Parent::edgeFromId(id); |
| 368 | 368 | } |
| 369 | 369 | |
diff --git a/lemon/edge_set.h b/lemon/edge_set.h
|
a
|
b
|
|
| 867 | 867 | arc.id = arcs.size() - 1; |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | | void next(Arc& arc) const { |
| | 870 | static void next(Arc& arc) { |
| 871 | 871 | --arc.id; |
| 872 | 872 | } |
| 873 | 873 | |
| … |
… |
|
| 1173 | 1173 | arc.id = arcs.size() - 1; |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | | void next(Arc& arc) const { |
| | 1176 | static void next(Arc& arc) { |
| 1177 | 1177 | --arc.id; |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| … |
… |
|
| 1181 | 1181 | arc.id = arcs.size() / 2 - 1; |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | | void next(Edge& arc) const { |
| | 1184 | static void next(Edge& arc) { |
| 1185 | 1185 | --arc.id; |
| 1186 | 1186 | } |
| 1187 | 1187 | |
diff --git a/lemon/full_graph.h b/lemon/full_graph.h
|
a
|
b
|
|
| 51 | 51 | typedef True ArcNumTag; |
| 52 | 52 | |
| 53 | 53 | 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; } |
| 55 | 55 | |
| 56 | 56 | Arc arc(const Node& s, const Node& t) const { |
| 57 | 57 | return Arc(s._id * _node_num + t._id); |
| … |
… |
|
| 209 | 209 | /// digraph its nodes can be indexed with integers from the range |
| 210 | 210 | /// <tt>[0..nodeNum()-1]</tt>. |
| 211 | 211 | /// \sa operator() |
| 212 | | int index(const Node& node) const { return Parent::index(node); } |
| | 212 | static int index(const Node& node) { return Parent::index(node); } |
| 213 | 213 | |
| 214 | 214 | /// \brief Returns the arc connecting the given nodes. |
| 215 | 215 | /// |
| … |
… |
|
| 283 | 283 | public: |
| 284 | 284 | |
| 285 | 285 | 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; } |
| 287 | 287 | |
| 288 | 288 | Edge edge(const Node& u, const Node& v) const { |
| 289 | 289 | if (u._id < v._id) { |
| … |
… |
|
| 580 | 580 | /// graph its nodes can be indexed with integers from the range |
| 581 | 581 | /// <tt>[0..nodeNum()-1]</tt>. |
| 582 | 582 | /// \sa operator() |
| 583 | | int index(const Node& node) const { return Parent::index(node); } |
| | 583 | static int index(const Node& node) { return Parent::index(node); } |
| 584 | 584 | |
| 585 | 585 | /// \brief Returns the arc connecting the given nodes. |
| 586 | 586 | /// |
diff --git a/lemon/hypercube_graph.h b/lemon/hypercube_graph.h
|
a
|
b
|
|
| 262 | 262 | return arc._id >> _dim; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | | int index(Node node) const { |
| | 265 | static int index(Node node) { |
| 266 | 266 | return node._id; |
| 267 | 267 | } |
| 268 | 268 | |
| … |
… |
|
| 337 | 337 | /// |
| 338 | 338 | /// Gives back the index of the given node. |
| 339 | 339 | /// The lower bits of the integer describes the node. |
| 340 | | int index(Node node) const { |
| | 340 | static int index(Node node) { |
| 341 | 341 | return Parent::index(node); |
| 342 | 342 | } |
| 343 | 343 | |
diff --git a/lemon/smart_graph.h b/lemon/smart_graph.h
|
a
|
b
|
|
| 508 | 508 | node._id = nodes.size() - 1; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | | void next(Node& node) const { |
| | 511 | static void next(Node& node) { |
| 512 | 512 | --node._id; |
| 513 | 513 | } |
| 514 | 514 | |
| … |
… |
|
| 516 | 516 | arc._id = arcs.size() - 1; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | | void next(Arc& arc) const { |
| | 519 | static void next(Arc& arc) { |
| 520 | 520 | --arc._id; |
| 521 | 521 | } |
| 522 | 522 | |
| … |
… |
|
| 524 | 524 | arc._id = arcs.size() / 2 - 1; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | | void next(Edge& arc) const { |
| | 527 | static void next(Edge& arc) { |
| 528 | 528 | --arc._id; |
| 529 | 529 | } |
| 530 | 530 | |
diff --git a/lemon/static_graph.h b/lemon/static_graph.h
|
a
|
b
|
|
| 92 | 92 | void firstIn(Arc& e, const Node& n) const { e.id = node_first_in[n.id]; } |
| 93 | 93 | void nextIn(Arc& e) const { e.id = arc_next_in[e.id]; } |
| 94 | 94 | |
| 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); } |
| 97 | 97 | int maxNodeId() const { return node_num - 1; } |
| 98 | 98 | |
| 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); } |
| 101 | 101 | int maxArcId() const { return arc_num - 1; } |
| 102 | 102 | |
| 103 | 103 | typedef True NodeNumTag; |
| … |
… |
|
| 268 | 268 | /// |
| 269 | 269 | /// This function returns the node with the given index. |
| 270 | 270 | /// \sa index() |
| 271 | | Node node(int ix) const { return Parent::nodeFromId(ix); } |
| | 271 | static Node node(int ix) { return Parent::nodeFromId(ix); } |
| 272 | 272 | |
| 273 | 273 | /// \brief The arc with the given index. |
| 274 | 274 | /// |
| 275 | 275 | /// This function returns the arc with the given index. |
| 276 | 276 | /// \sa index() |
| 277 | | Arc arc(int ix) const { return Parent::arcFromId(ix); } |
| | 277 | static Arc arc(int ix) { return Parent::arcFromId(ix); } |
| 278 | 278 | |
| 279 | 279 | /// \brief The index of the given node. |
| 280 | 280 | /// |
| 281 | 281 | /// This function returns the index of the the given node. |
| 282 | 282 | /// \sa node() |
| 283 | | int index(Node node) const { return Parent::id(node); } |
| | 283 | static int index(Node node) { return Parent::id(node); } |
| 284 | 284 | |
| 285 | 285 | /// \brief The index of the given arc. |
| 286 | 286 | /// |
| 287 | 287 | /// This function returns the index of the the given arc. |
| 288 | 288 | /// \sa arc() |
| 289 | | int index(Arc arc) const { return Parent::id(arc); } |
| | 289 | static int index(Arc arc) { return Parent::id(arc); } |
| 290 | 290 | |
| 291 | 291 | /// \brief Number of nodes. |
| 292 | 292 | /// |