Changeset 1986:9b56cca61e2e in lemon0.x
 Timestamp:
 02/27/06 11:36:01 (13 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2584
 Location:
 lemon
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

lemon/full_graph.h
r1979 r1986 37 37 namespace lemon { 38 38 39 /// \brief Base of the FullGrpah. 40 /// 41 /// Base of the FullGrpah. 39 42 class FullGraphBase { 40 43 int _nodeNum; … … 54 57 ///Creates a full graph with \c n nodes. 55 58 void construct(int n) { _nodeNum = n; _edgeNum = n * n; } 56 ///57 // FullGraphBase(const FullGraphBase &_g)58 // : _nodeNum(_g.nodeNum()), _edgeNum(_nodeNum*_nodeNum) { }59 59 60 60 typedef True NodeNumTag; 61 61 typedef True EdgeNumTag; 62 63 /// \brief Returns the node with the given index. 64 /// 65 /// Returns the node with the given index. Because it is a 66 /// static size graph the node's of the graph can be indiced 67 /// by the range from 0 to \e nodeNum()1 and the index of 68 /// the node can accessed by the \e index() member. 69 Node operator()(int index) const { return Node(index); } 70 71 /// \brief Returns the index of the node. 72 /// 73 /// Returns the index of the node. Because it is a 74 /// static size graph the node's of the graph can be indiced 75 /// by the range from 0 to \e nodeNum()1 and the index of 76 /// the node can accessed by the \e index() member. 77 int index(const Node& node) const { return node.id; } 62 78 63 79 ///Number of nodes. … … 203 219 /// \sa concept::StaticGraph. 204 220 /// 221 /// \sa FullGraphBase 222 /// \sa FullUGraph 223 /// 205 224 /// \author Alpar Juttner 206 225 class FullGraph : public ExtendedFullGraphBase { … … 215 234 /// \brief Resize the graph 216 235 /// 236 /// Resize the graph. The function will fully destroy and build the graph. 237 /// This cause that the maps of the graph will reallocated 238 /// automatically and the previous values will be lost. 217 239 void resize(int n) { 218 240 Parent::getNotifier(Edge()).clear(); … … 225 247 226 248 249 /// \brief Base of the FullUGrpah. 250 /// 251 /// Base of the FullUGrpah. 227 252 class FullUGraphBase { 228 253 int _nodeNum; … … 242 267 ///Creates a full graph with \c n nodes. 243 268 void construct(int n) { _nodeNum = n; _edgeNum = n * (n  1) / 2; } 244 /// 245 // FullGraphBase(const FullGraphBase &_g) 246 // : _nodeNum(_g.nodeNum()), _edgeNum(_nodeNum*_nodeNum) { } 247 269 270 /// \brief Returns the node with the given index. 271 /// 272 /// Returns the node with the given index. Because it is a 273 /// static size graph the node's of the graph can be indiced 274 /// by the range from 0 to \e nodeNum()1 and the index of 275 /// the node can accessed by the \e index() member. 276 Node operator()(int index) const { return Node(index); } 277 278 /// \brief Returns the index of the node. 279 /// 280 /// Returns the index of the node. Because it is a 281 /// static size graph the node's of the graph can be indiced 282 /// by the range from 0 to \e nodeNum()1 and the index of 283 /// the node can accessed by the \e index() member. 284 int index(const Node& node) const { return node.id; } 285 248 286 typedef True NodeNumTag; 249 287 typedef True EdgeNumTag; … … 276 314 277 315 278 /// Node ID.279 316 /// \brief Node ID. 317 /// 280 318 /// The ID of a valid Node is a nonnegative integer not greater than 281 319 /// \ref maxNodeId(). The range of the ID's is not surely continuous … … 283 321 /// 284 322 /// The ID of the \ref INVALID node is 1. 285 /// \return The ID of the node \c v.323 /// \return The ID of the node \c v. 286 324 287 325 static int id(Node v) { return v.id; } 288 /// Edge ID. 289 326 327 /// \brief Edge ID. 328 /// 290 329 /// The ID of a valid Edge is a nonnegative integer not greater than 291 330 /// \ref maxEdgeId(). The range of the ID's is not surely continuous … … 296 335 static int id(Edge e) { return e.id; } 297 336 298 /// Finds an edge between two nodes.299 337 /// \brief Finds an edge between two nodes. 338 /// 300 339 /// Finds an edge from node \c u to node \c v. 301 340 /// … … 305 344 /// \return The found edge or INVALID if there is no such an edge. 306 345 Edge findEdge(Node u, Node v, Edge prev = INVALID) const { 307 if (prev.id != 1  u.id <= v.id) return 1;346 if (prev.id != 1  u.id <= v.id) return Edge(1); 308 347 return Edge(u.id * (u.id  1) / 2 + v.id); 309 348 } … … 404 443 /// it does not contain the loop edges. 405 444 /// 445 /// \sa FullUGraphBase 406 446 /// \sa FullGraph 407 447 /// … … 417 457 /// \brief Resize the graph 418 458 /// 459 /// Resize the graph. The function will fully destroy and build the graph. 460 /// This cause that the maps of the graph will reallocated 461 /// automatically and the previous values will be lost. 419 462 void resize(int n) { 420 463 Parent::getNotifier(Edge()).clear(); … … 613 656 /// edges or nodes. 614 657 /// 658 /// \sa FullUGraphBase 615 659 /// \sa FullGraph 616 660 /// 
lemon/grid_ugraph.h
r1979 r1986 127 127 /// Gives back the node on the given position. 128 128 Node operator()(int i, int j) const { 129 LEMON_ASSERT(0 <= i && i < width() && 0 <= j && j < height(), IndexError()); 129 LEMON_ASSERT(0 <= i && i < width() && 0 <= j && 130 j < height(), IndexError()); 130 131 return Node(i + j * _width); 131 132 } 
lemon/hypercube_graph.h
r1979 r1986 225 225 /// 226 226 /// Gives back the node by its index. 227 Node node(int index) const {227 Node operator()(int index) const { 228 228 return Node(index); 229 229 }
Note: See TracChangeset
for help on using the changeset viewer.