336 int _nodeNum, _edgeNum; |
336 int _nodeNum, _edgeNum; |
337 int _edgeLimit; |
337 int _edgeLimit; |
338 }; |
338 }; |
339 |
339 |
340 |
340 |
341 typedef StaticMappableUndirGraphExtender< |
341 typedef StaticMappableUGraphExtender< |
342 IterableUndirGraphExtender< |
342 IterableUGraphExtender< |
343 AlterableUndirGraphExtender< |
343 AlterableUGraphExtender< |
344 UndirGraphExtender<GridGraphBase> > > > ExtendedGridGraphBase; |
344 UGraphExtender<GridGraphBase> > > > ExtendedGridGraphBase; |
345 |
345 |
346 /// \ingroup graphs |
346 /// \ingroup graphs |
347 /// |
347 /// |
348 /// \brief Grid graph class |
348 /// \brief Grid graph class |
349 /// |
349 /// |
362 /// val[graph(i, j)] = i + j; |
362 /// val[graph(i, j)] = i + j; |
363 /// } |
363 /// } |
364 /// } |
364 /// } |
365 /// \endcode |
365 /// \endcode |
366 /// |
366 /// |
367 /// The graph type is fully conform to the \ref concept::UndirGraph |
367 /// The graph type is fully conform to the \ref concept::UGraph |
368 /// "Undirected Graph" concept. |
368 /// "Undirected Graph" concept. |
369 /// |
369 /// |
370 /// \author Balazs Dezso |
370 /// \author Balazs Dezso |
371 /// \see GridGraphBase |
371 /// \see GridGraphBase |
372 class GridGraph : public ExtendedGridGraphBase { |
372 class GridGraph : public ExtendedGridGraphBase { |
461 /// \brief Gives back the edge goes down from the node. |
461 /// \brief Gives back the edge goes down from the node. |
462 /// |
462 /// |
463 /// Gives back the edge goes down from the node. If there is not |
463 /// Gives back the edge goes down from the node. If there is not |
464 /// outgoing edge then it gives back INVALID. |
464 /// outgoing edge then it gives back INVALID. |
465 Edge down(Node n) const { |
465 Edge down(Node n) const { |
466 UndirEdge ue = _down(n); |
466 UEdge ue = _down(n); |
467 return ue != INVALID ? direct(ue, true) : INVALID; |
467 return ue != INVALID ? direct(ue, true) : INVALID; |
468 } |
468 } |
469 |
469 |
470 /// \brief Gives back the edge goes up from the node. |
470 /// \brief Gives back the edge goes up from the node. |
471 /// |
471 /// |
472 /// Gives back the edge goes up from the node. If there is not |
472 /// Gives back the edge goes up from the node. If there is not |
473 /// outgoing edge then it gives back INVALID. |
473 /// outgoing edge then it gives back INVALID. |
474 Edge up(Node n) const { |
474 Edge up(Node n) const { |
475 UndirEdge ue = _up(n); |
475 UEdge ue = _up(n); |
476 return ue != INVALID ? direct(ue, false) : INVALID; |
476 return ue != INVALID ? direct(ue, false) : INVALID; |
477 } |
477 } |
478 |
478 |
479 /// \brief Gives back the edge goes right from the node. |
479 /// \brief Gives back the edge goes right from the node. |
480 /// |
480 /// |
481 /// Gives back the edge goes right from the node. If there is not |
481 /// Gives back the edge goes right from the node. If there is not |
482 /// outgoing edge then it gives back INVALID. |
482 /// outgoing edge then it gives back INVALID. |
483 Edge right(Node n) const { |
483 Edge right(Node n) const { |
484 UndirEdge ue = _right(n); |
484 UEdge ue = _right(n); |
485 return ue != INVALID ? direct(ue, true) : INVALID; |
485 return ue != INVALID ? direct(ue, true) : INVALID; |
486 } |
486 } |
487 |
487 |
488 /// \brief Gives back the edge goes left from the node. |
488 /// \brief Gives back the edge goes left from the node. |
489 /// |
489 /// |
490 /// Gives back the edge goes left from the node. If there is not |
490 /// Gives back the edge goes left from the node. If there is not |
491 /// outgoing edge then it gives back INVALID. |
491 /// outgoing edge then it gives back INVALID. |
492 Edge left(Node n) const { |
492 Edge left(Node n) const { |
493 UndirEdge ue = _left(n); |
493 UEdge ue = _left(n); |
494 return ue != INVALID ? direct(ue, false) : INVALID; |
494 return ue != INVALID ? direct(ue, false) : INVALID; |
495 } |
495 } |
496 |
496 |
497 }; |
497 }; |
498 |
498 |