COIN-OR::LEMON - Graph Library

Ticket #83: smart_graph_fix.patch

File smart_graph_fix.patch, 3.8 KB (added by Balazs Dezso, 14 years ago)
  • lemon/bits/graph_extender.h

    # HG changeset patch
    # User Balazs Dezso <deba@inf.elte.hu>
    # Date 1208188859 -7200
    # Node ID e72158b5baccec9b28861630606e241fa6f4f34d
    # Parent  ae7785fe84315de6be35a182420b6369e851f00d
    Fix graph concept, extender and smart graph
    
    diff -r ae7785fe8431 -r e72158b5bacc lemon/bits/graph_extender.h
    a b namespace lemon { 
    367367    }
    368368
    369369    Node oppositeNode(const Node &n, const Edge &e) const {
    370       if( n == Parent::source(e))
    371         return Parent::target(e);
    372       else if( n == Parent::target(e))
    373         return Parent::source(e);
     370      if( n == Parent::u(e))
     371        return Parent::v(e);
     372      else if( n == Parent::v(e))
     373        return Parent::u(e);
    374374      else
    375375        return INVALID;
    376376    }
    namespace lemon { 
    381381
    382382    using Parent::direct;
    383383    Arc direct(const Edge &edge, const Node &node) const {
    384       return Parent::direct(edge, Parent::source(edge) == node);
     384      return Parent::direct(edge, Parent::u(edge) == node);
    385385    }
    386386
    387387    // Alterable extension
    namespace lemon { 
    586586    ///
    587587    /// Returns the base node of the iterator
    588588    Node baseNode(const IncEdgeIt &edge) const {
    589       return edge._direction ? source(edge) : target(edge);
     589      return edge._direction ? u(edge) : v(edge);
    590590    }
    591591    /// Running node of the iterator
    592592    ///
    593593    /// Returns the running node of the iterator
    594594    Node runningNode(const IncEdgeIt &edge) const {
    595       return edge._direction ? target(edge) : source(edge);
     595      return edge._direction ? v(edge) : u(edge);
    596596    }
    597597
    598598    // Mappable extension
  • lemon/concepts/digraph.h

    diff -r ae7785fe8431 -r e72158b5bacc lemon/concepts/digraph.h
    a b namespace lemon { 
    467467        }
    468468      };
    469469
    470       template <typename RDigraph>
     470      template <typename _Digraph>
    471471      struct Constraints {
    472472        void constraints() {
    473           checkConcept<IterableDigraphComponent<>, Digraph>();
    474           checkConcept<IDableDigraphComponent<>, Digraph>();
    475           checkConcept<MappableDigraphComponent<>, Digraph>();
     473          checkConcept<IterableDigraphComponent<>, _Digraph>();
     474          checkConcept<IDableDigraphComponent<>, _Digraph>();
     475          checkConcept<MappableDigraphComponent<>, _Digraph>();
    476476        }
    477477      };
    478478
  • lemon/concepts/graph.h

    diff -r ae7785fe8431 -r e72158b5bacc lemon/concepts/graph.h
    a b namespace lemon { 
    731731        return INVALID;
    732732      }
    733733
    734       template <typename Graph>
     734      template <typename _Graph>
    735735      struct Constraints {
    736736        void constraints() {
    737           checkConcept<IterableGraphComponent<>, Graph>();
    738           checkConcept<IDableGraphComponent<>, Graph>();
    739           checkConcept<MappableGraphComponent<>, Graph>();
     737          checkConcept<IterableGraphComponent<>, _Graph>();
     738          checkConcept<IDableGraphComponent<>, _Graph>();
     739          checkConcept<MappableGraphComponent<>, _Graph>();
    740740        }
    741741      };
    742742
  • lemon/smart_graph.h

    diff -r ae7785fe8431 -r e72158b5bacc lemon/smart_graph.h
    a b namespace lemon { 
    470470    Node source(Arc e) const { return Node(arcs[e._id ^ 1].target); }
    471471    Node target(Arc e) const { return Node(arcs[e._id].target); }
    472472
    473     Node source(Edge e) const { return Node(arcs[2 * e._id].target); }
    474     Node target(Edge e) const { return Node(arcs[2 * e._id + 1].target); }
     473    Node u(Edge e) const { return Node(arcs[2 * e._id].target); }
     474    Node v(Edge e) const { return Node(arcs[2 * e._id + 1].target); }
    475475
    476476    static bool direction(Arc e) {
    477477      return (e._id & 1) == 1;