gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Fix various rename bugs
0 3 0
default
3 files changed with 9 insertions and 11 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -1403,50 +1403,50 @@
1403 1403
    public:
1404 1404

	
1405 1405
      typedef _Base Base;
1406 1406
      typedef typename Base::Node Node;
1407 1407
      typedef typename Base::Edge Edge;
1408 1408

	
1409 1409
      /// \brief Erase a node from the graph.
1410 1410
      ///
1411 1411
      /// Erase a node from the graph. This function should erase
1412 1412
      /// arcs connecting to the node.
1413 1413
      void erase(const Node&) {}    
1414 1414

	
1415 1415
      /// \brief Erase an arc from the graph.
1416 1416
      ///
1417 1417
      /// Erase an arc from the graph.
1418 1418
      ///
1419 1419
      void erase(const Edge&) {}
1420 1420

	
1421 1421
      template <typename _Graph>
1422 1422
      struct Constraints {
1423 1423
	void constraints() {
1424 1424
          checkConcept<Base, _Graph>();
1425 1425
	  typename _Graph::Node node;
1426 1426
	  graph.erase(node);
1427
	  typename _Graph::Arc arc;
1428
	  graph.erase(arc);
1427
	  typename _Graph::Edge edge;
1428
	  graph.erase(edge);
1429 1429
	}
1430 1430

	
1431 1431
	_Graph& graph;
1432 1432
      };
1433 1433
    };
1434 1434

	
1435 1435
    /// \brief An empty clearable base digraph class.
1436 1436
    ///
1437 1437
    /// This class provides beside the core digraph features core clear
1438 1438
    /// functions for the digraph structure. The main difference between
1439 1439
    /// the base and this interface is that the digraph alterations
1440 1440
    /// should handled already on this level.
1441 1441
    template <typename _Base = BaseDigraphComponent>
1442 1442
    class ClearableDigraphComponent : public _Base {
1443 1443
    public:
1444 1444

	
1445 1445
      typedef _Base Base;
1446 1446

	
1447 1447
      /// \brief Erase all nodes and arcs from the digraph.
1448 1448
      ///
1449 1449
      /// Erase all nodes and arcs from the digraph.
1450 1450
      ///
1451 1451
      void clear() {}    
1452 1452

	
Ignore white space 48 line context
1 1
/* -*- C++ -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library
4 4
 *
5 5
 * Copyright (C) 2003-2008
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_DIJKSTRA_H
20 20
#define LEMON_DIJKSTRA_H
21 21

	
22 22
///\ingroup shortest_path
23 23
///\file
24 24
///\brief Dijkstra algorithm.
25
///
26 25

	
27
#include <lemon/list_digraph.h>
26
#include <lemon/list_graph.h>
28 27
#include <lemon/bin_heap.h>
29 28
#include <lemon/bits/path_dump.h>
30 29
#include <lemon/bits/invalid.h>
31 30
#include <lemon/error.h>
32 31
#include <lemon/maps.h>
33 32

	
34

	
35 33
namespace lemon {
36 34

	
37 35
  /// \brief Default OperationTraits for the Dijkstra algorithm class.
38 36
  ///  
39 37
  /// It defines all computational operations and constants which are
40 38
  /// used in the Dijkstra algorithm.
41 39
  template <typename Value>
42 40
  struct DijkstraDefaultOperationTraits {
43 41
    /// \brief Gives back the zero value of the type.
44 42
    static Value zero() {
45 43
      return static_cast<Value>(0);
46 44
    }
47 45
    /// \brief Gives back the sum of the given two elements.
48 46
    static Value plus(const Value& left, const Value& right) {
49 47
      return left + right;
50 48
    }
51 49
    /// \brief Gives back true only if the first value less than the second.
52 50
    static bool less(const Value& left, const Value& right) {
53 51
      return left < right;
54 52
    }
55 53
  };
56 54

	
57 55
  /// \brief Widest path OperationTraits for the Dijkstra algorithm class.
58 56
  ///  
Ignore white space 48 line context
... ...
@@ -381,152 +381,152 @@
381 381
    /// \brief Increment operator.
382 382
    ///
383 383
    /// It increments the iterator and gives back the next arc.
384 384
    ConArcIt& operator++() {
385 385
      Parent::operator=(findArc(_graph, _graph.source(*this), 
386 386
				_graph.target(*this), *this));
387 387
      return *this;
388 388
    }
389 389
  private:
390 390
    const Graph& _graph;
391 391
  };
392 392

	
393 393
  namespace _graph_utils_bits {
394 394
    
395 395
    template <typename Graph, typename Enable = void>
396 396
    struct FindEdgeSelector {
397 397
      typedef typename Graph::Node Node;
398 398
      typedef typename Graph::Edge Edge;
399 399
      static Edge find(const Graph &g, Node u, Node v, Edge e) {
400 400
        bool b;
401 401
        if (u != v) {
402 402
          if (e == INVALID) {
403 403
            g.firstInc(e, b, u);
404 404
          } else {
405
            b = g.source(e) == u;
405
            b = g.u(e) == u;
406 406
            g.nextInc(e, b);
407 407
          }
408
          while (e != INVALID && (b ? g.target(e) : g.source(e)) != v) {
408
          while (e != INVALID && (b ? g.v(e) : g.u(e)) != v) {
409 409
            g.nextInc(e, b);
410 410
          }
411 411
        } else {
412 412
          if (e == INVALID) {
413 413
            g.firstInc(e, b, u);
414 414
          } else {
415 415
            b = true;
416 416
            g.nextInc(e, b);
417 417
          }
418
          while (e != INVALID && (!b || g.target(e) != v)) {
418
          while (e != INVALID && (!b || g.v(e) != v)) {
419 419
            g.nextInc(e, b);
420 420
          }
421 421
        }
422 422
        return e;
423 423
      }
424 424
    };
425 425

	
426 426
    template <typename Graph>
427 427
    struct FindEdgeSelector<
428 428
      Graph, 
429 429
      typename enable_if<typename Graph::FindEdgeTag, void>::type> 
430 430
    {
431 431
      typedef typename Graph::Node Node;
432 432
      typedef typename Graph::Edge Edge;
433 433
      static Edge find(const Graph &g, Node u, Node v, Edge prev) {
434 434
        return g.findEdge(u, v, prev);
435 435
      }
436 436
    };    
437 437
  }
438 438

	
439 439
  /// \brief Finds an edge between two nodes of a graph.
440 440
  ///
441 441
  /// Finds an edge from node \c u to node \c v in graph \c g.
442 442
  /// If the node \c u and node \c v is equal then each loop edge
443 443
  /// will be enumerated once.
444 444
  ///
445 445
  /// If \c prev is \ref INVALID (this is the default value), then
446 446
  /// it finds the first arc from \c u to \c v. Otherwise it looks for
447 447
  /// the next arc from \c u to \c v after \c prev.
448 448
  /// \return The found arc or \ref INVALID if there is no such an arc.
449 449
  ///
450 450
  /// Thus you can iterate through each arc from \c u to \c v as it follows.
451 451
  ///\code
452 452
  /// for(Edge e = findEdge(g,u,v); e != INVALID; 
453 453
  ///     e = findEdge(g,u,v,e)) {
454 454
  ///   ...
455 455
  /// }
456 456
  ///\endcode
457 457
  ///
458
  ///\sa ConArcIt
458
  ///\sa ConEdgeIt
459 459

	
460 460
  template <typename Graph>
461 461
  inline typename Graph::Edge 
462 462
  findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
463 463
            typename Graph::Edge p = INVALID) {
464 464
    return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, p);
465 465
  }
466 466

	
467 467
  /// \brief Iterator for iterating on edges connected the same nodes.
468 468
  ///
469 469
  /// Iterator for iterating on edges connected the same nodes. It is 
470 470
  /// higher level interface for the findEdge() function. You can
471 471
  /// use it the following way:
472 472
  ///\code
473 473
  /// for (ConEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) {
474 474
  ///   ...
475 475
  /// }
476 476
  ///\endcode
477 477
  ///
478 478
  ///\sa findEdge()
479 479
  template <typename _Graph>
480 480
  class ConEdgeIt : public _Graph::Edge {
481 481
  public:
482 482

	
483 483
    typedef _Graph Graph;
484 484
    typedef typename Graph::Edge Parent;
485 485

	
486 486
    typedef typename Graph::Edge Edge;
487 487
    typedef typename Graph::Node Node;
488 488

	
489 489
    /// \brief Constructor.
490 490
    ///
491 491
    /// Construct a new ConEdgeIt iterating on the edges which
492 492
    /// connects the \c u and \c v node.
493 493
    ConEdgeIt(const Graph& g, Node u, Node v) : _graph(g) {
494 494
      Parent::operator=(findEdge(_graph, u, v));
495 495
    }
496 496

	
497 497
    /// \brief Constructor.
498 498
    ///
499 499
    /// Construct a new ConEdgeIt which continues the iterating from 
500 500
    /// the \c e edge.
501 501
    ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
502 502
    
503 503
    /// \brief Increment operator.
504 504
    ///
505 505
    /// It increments the iterator and gives back the next edge.
506 506
    ConEdgeIt& operator++() {
507
      Parent::operator=(findEdge(_graph, _graph.source(*this), 
508
				 _graph.target(*this), *this));
507
      Parent::operator=(findEdge(_graph, _graph.u(*this), 
508
				 _graph.v(*this), *this));
509 509
      return *this;
510 510
    }
511 511
  private:
512 512
    const Graph& _graph;
513 513
  };
514 514

	
515 515
  namespace _graph_utils_bits {
516 516

	
517 517
    template <typename Digraph, typename Item, typename RefMap>
518 518
    class MapCopyBase {
519 519
    public:
520 520
      virtual void copy(const Digraph& from, const RefMap& refMap) = 0;
521 521
      
522 522
      virtual ~MapCopyBase() {}
523 523
    };
524 524

	
525 525
    template <typename Digraph, typename Item, typename RefMap, 
526 526
              typename ToMap, typename FromMap>
527 527
    class MapCopy : public MapCopyBase<Digraph, Item, RefMap> {
528 528
    public:
529 529

	
530 530
      MapCopy(ToMap& tmap, const FromMap& map) 
531 531
        : _tmap(tmap), _map(map) {}
532 532
      
0 comments (0 inline)