28 #include <lemon/bits/clearable_graph_extender.h> |
28 #include <lemon/bits/clearable_graph_extender.h> |
29 #include <lemon/bits/extendable_graph_extender.h> |
29 #include <lemon/bits/extendable_graph_extender.h> |
30 #include <lemon/bits/iterable_graph_extender.h> |
30 #include <lemon/bits/iterable_graph_extender.h> |
31 #include <lemon/bits/alteration_notifier.h> |
31 #include <lemon/bits/alteration_notifier.h> |
32 #include <lemon/bits/default_map.h> |
32 #include <lemon/bits/default_map.h> |
33 |
33 #include <lemon/bits/graph_extender.h> |
34 #include <lemon/bits/undir_graph_extender.h> |
|
35 |
34 |
36 #include <lemon/utility.h> |
35 #include <lemon/utility.h> |
37 |
36 |
38 namespace lemon { |
37 namespace lemon { |
39 |
38 |
88 |
87 |
89 /// Maximum node ID. |
88 /// Maximum node ID. |
90 |
89 |
91 /// Maximum node ID. |
90 /// Maximum node ID. |
92 ///\sa id(Node) |
91 ///\sa id(Node) |
93 int maxId(Node) const { return nodes.size()-1; } |
92 int maxNodeId() const { return nodes.size()-1; } |
94 /// Maximum edge ID. |
93 /// Maximum edge ID. |
95 |
94 |
96 /// Maximum edge ID. |
95 /// Maximum edge ID. |
97 ///\sa id(Edge) |
96 ///\sa id(Edge) |
98 int maxId(Edge) const { return edges.size()-1; } |
97 int maxEdgeId() const { return edges.size()-1; } |
99 |
98 |
100 Node source(Edge e) const { return edges[e.n].source; } |
99 Node source(Edge e) const { return edges[e.n].source; } |
101 Node target(Edge e) const { return edges[e.n].target; } |
100 Node target(Edge e) const { return edges[e.n].target; } |
102 |
101 |
103 /// Node ID. |
102 /// Node ID. |
104 |
103 |
105 /// The ID of a valid Node is a nonnegative integer not greater than |
104 /// The ID of a valid Node is a nonnegative integer not greater than |
106 /// \ref maxId(Node). The range of the ID's is not surely continuous |
105 /// \ref maxNodeId(). The range of the ID's is not surely continuous |
107 /// and the greatest node ID can be actually less then \ref maxId(Node). |
106 /// and the greatest node ID can be actually less then \ref maxNodeId(). |
108 /// |
107 /// |
109 /// The ID of the \ref INVALID node is -1. |
108 /// The ID of the \ref INVALID node is -1. |
110 ///\return The ID of the node \c v. |
109 ///\return The ID of the node \c v. |
111 static int id(Node v) { return v.n; } |
110 static int id(Node v) { return v.n; } |
112 /// Edge ID. |
111 /// Edge ID. |
113 |
112 |
114 /// The ID of a valid Edge is a nonnegative integer not greater than |
113 /// The ID of a valid Edge is a nonnegative integer not greater than |
115 /// \ref maxId(Edge). The range of the ID's is not surely continuous |
114 /// \ref maxEdgeId(). The range of the ID's is not surely continuous |
116 /// and the greatest edge ID can be actually less then \ref maxId(Edge). |
115 /// and the greatest edge ID can be actually less then \ref maxEdgeId(). |
117 /// |
116 /// |
118 /// The ID of the \ref INVALID edge is -1. |
117 /// The ID of the \ref INVALID edge is -1. |
119 ///\return The ID of the edge \c e. |
118 ///\return The ID of the edge \c e. |
120 static int id(Edge e) { return e.n; } |
119 static int id(Edge e) { return e.n; } |
121 |
120 |
122 static Node fromId(int id, Node) { return Node(id);} |
121 static Node nodeFromId(int id) { return Node(id);} |
123 |
122 |
124 static Edge fromId(int id, Edge) { return Edge(id);} |
123 static Edge edgeFromId(int id) { return Edge(id);} |
125 |
124 |
126 Node addNode() { |
125 Node addNode() { |
127 Node n; n.n=nodes.size(); |
126 Node n; n.n=nodes.size(); |
128 nodes.push_back(NodeT()); //FIXME: Hmmm... |
127 nodes.push_back(NodeT()); //FIXME: Hmmm... |
129 return n; |
128 return n; |
228 |
221 |
229 typedef ClearableGraphExtender< |
222 typedef ClearableGraphExtender< |
230 ExtendableGraphExtender< |
223 ExtendableGraphExtender< |
231 MappableGraphExtender< |
224 MappableGraphExtender< |
232 IterableGraphExtender< |
225 IterableGraphExtender< |
233 AlterableGraphExtender<SmartGraphBase> > > > > ExtendedSmartGraphBase; |
226 AlterableGraphExtender< |
234 |
227 GraphExtender<SmartGraphBase> > > > > > ExtendedSmartGraphBase; |
235 /// \addtogroup graphs |
228 |
236 /// @{ |
229 /// \ingroup graphs |
237 |
230 |
238 ///A smart graph class. |
231 ///A smart graph class. |
239 |
232 |
240 ///This is a simple and fast graph implementation. |
233 ///This is a simple and fast graph implementation. |
241 ///It is also quite memory efficient, but at the price |
234 ///It is also quite memory efficient, but at the price |