COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
08/11/05 17:55:17 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2135
Message:

Some modification on the undirected graph interface.
Doc improvments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/undir_graph_extender.h

    r1435 r1627  
    4343      bool forward;
    4444
     45      Edge(const UndirEdge &ue, bool _forward) :
     46        UndirEdge(ue), forward(_forward) {}
     47
    4548    public:
    4649      Edge() {}
    47 
    48       /// \brief Directed edge from undirected edge and a direction.
    49       ///
    50       /// This constructor is not a part of the concept interface of
    51       /// undirected graph, so please avoid using it if possible!
    52       Edge(const UndirEdge &ue, bool _forward) :
    53         UndirEdge(ue), forward(_forward) {}
    54 
    55       /// \brief Directed edge from undirected edge and a source node.
    56       ///
    57       /// Constructs a directed edge from undirected edge and a source node.
    58       ///
    59       /// \note You have to specify the graph for this constructor.
    60       Edge(const Graph &g, const UndirEdge &ue, const Node &n) :
    61         UndirEdge(ue) { forward = (g.source(ue) == n); }
    6250
    6351      /// Invalid edge constructor
     
    8068    ///
    8169    /// Returns the Edge of opposite direction.
    82     Edge opposite(const Edge &e) const {
     70    Edge oppositeEdge(const Edge &e) const {
    8371      return Edge(e,!e.forward);
    8472    }
     
    114102      return _dirTarget(e);
    115103    }
    116 
    117     /// Returns whether the given directed edge is same orientation as the
    118     /// corresponding undirected edge.
    119     ///
    120     /// \todo reference to the corresponding point of the undirected graph
    121     /// concept. "What does the direction of an undirected edge mean?"
    122     bool forward(const Edge &e) const { return e.forward; }
    123104
    124105    Node oppositeNode(const Node &n, const UndirEdge &e) const {
     
    131112    }
    132113
    133     /// Directed edge from an undirected edge and a source node.
     114    /// \brief Directed edge from an undirected edge and a source node.
    134115    ///
    135116    /// Returns a (directed) Edge corresponding to the specified UndirEdge
    136117    /// and source Node.
    137118    ///
    138     ///\todo Do we need this?
    139     ///
    140     ///\todo Better name...
    141     Edge edgeWithSource(const UndirEdge &ue, const Node &s) const {
    142       return Edge(*this, ue, s);
    143     }
     119    Edge direct(const UndirEdge &ue, const Node &s) const {
     120      return Edge(ue, s == source(ue));
     121    }
     122
     123    /// \brief Directed edge from an undirected edge.
     124    ///
     125    /// Returns a directed edge corresponding to the specified UndirEdge.
     126    /// If the given bool is true the given undirected edge and the
     127    /// returned edge have the same source node.
     128    Edge direct(const UndirEdge &ue, bool d) const {
     129      return Edge(ue, d);
     130    }
     131
     132    /// Returns whether the given directed edge is same orientation as the
     133    /// corresponding undirected edge.
     134    ///
     135    /// \todo reference to the corresponding point of the undirected graph
     136    /// concept. "What does the direction of an undirected edge mean?"
     137    bool direction(const Edge &e) const { return e.forward; }
     138
    144139
    145140    using Parent::first;
Note: See TracChangeset for help on using the changeset viewer.