COIN-OR::LEMON - Graph Library

Changeset 1158:29961fa390a3 in lemon-0.x for src/lemon/concept


Ignore:
Timestamp:
02/20/05 02:02:07 (15 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1559
Message:

Graph and UndirGraph? concept modifications.

  • For incidence iterators ({In,Out,Inc}EdgeIt?) there is now baseNode and runningNode functions in graph interface
  • For Edge in undir graphs: Edge(UndirGraph? const &, UndirEdge?, Node) constructor. Same for IncEdgeIt?
  • Edge(UndirEdge?, bool) constructor is no more in the public interface. (But we need it in the developpers interface).
Location:
src/lemon/concept
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/concept/graph_component.h

    r1136 r1158  
    626626          Edge e = it1;
    627627          e = it2;
    628         }
    629 
    630         Edge& edge;
    631         Node& node;
    632         Graph& graph;
     628
     629          const_constraits();
     630        }
     631
     632        void const_constraits() {
     633          Node n = graph.baseNode(it);
     634          n = graph.runningNode(it);
     635        }
     636
     637        Edge edge;
     638        Node node;
     639        Graph graph;
     640        _GraphIncIterator it;
    633641      };
    634642    };
  • src/lemon/concept/undir_graph.h

    r1030 r1158  
    3737    /// Skeleton class which describes an edge with direction in \ref
    3838    /// UndirGraph "undirected graph".
    39     template <typename UndirEdge>
    40     class UndirGraphEdge : public UndirEdge {
     39    template <typename UndirGraph>
     40    class UndirGraphEdge : public UndirGraph::UndirEdge {
     41      typedef typename UndirGraph::UndirEdge UndirEdge;
     42      typedef typename UndirGraph::Node Node;
    4143    public:
    4244
     
    5052      UndirGraphEdge(Invalid) {}
    5153
    52       /// \brief Constructs a directed version of an undirected edge
    53       ///
    54       /// \param forward If \c true the direction of the contructed edge
    55       /// is the same as the inherent direction of the \c undir_edge; if
    56       /// \c false --- the opposite.
    57       UndirGraphEdge(UndirEdge undir_edge, bool forward) {
     54      /// \brief Directed edge from undirected edge and a source node.
     55      ///
     56      /// Constructs a directed edge from undirected edge and a source node.
     57      ///
     58      /// \note You have to specify the graph for this constructor.
     59      UndirGraphEdge(const UndirGraph &g,
     60                     UndirEdge undir_edge, Node n) {
    5861        ignore_unused_variable_warning(undir_edge);
    59         ignore_unused_variable_warning(forward);
     62        ignore_unused_variable_warning(g);
     63        ignore_unused_variable_warning(n);
    6064      }
    6165
     
    7478      struct Constraints {
    7579        void constraints() {
     80          const_constraints();
     81        }
     82        void const_constraints() const {
    7683          /// \bug This should be is_base_and_derived ...
    7784          UndirEdge ue = e;
    7885          ue = e;
    79           Edge forward(ue, true);
    80           Edge backward(ue, false);
    81 
    82           ignore_unused_variable_warning(forward);
    83           ignore_unused_variable_warning(backward);
     86
     87          Edge e_with_source(graph,ue,n);
     88          ignore_unused_variable_warning(e_with_source);
    8489        }
    8590        Edge e;
     91        UndirEdge ue;
     92        UndirGraph graph;
     93        Node n;
    8694      };
    8795    };
     
    100108          checkConcept<BaseIterableGraphComponent, Graph>();
    101109          checkConcept<GraphItem<>, UndirEdge>();
    102           checkConcept<UndirGraphEdge<UndirEdge>, Edge>();
     110          checkConcept<UndirGraphEdge<Graph>, Edge>();
    103111
    104112          graph.first(ue);
     
    235243      /// Type describing an UndirEdge with direction
    236244#ifndef DOXYGEN
    237       typedef UndirGraphEdge<UndirEdge> Edge;
     245      typedef UndirGraphEdge<UndirGraph> Edge;
    238246#else
    239247      typedef UndirGraphEdge Edge;
     
    431439
    432440
     441      /// Base node of the iterator
     442      ///
     443      /// Returns the base node (the source in this case) of the iterator
     444      Node baseNode(OutEdgeIt e) const {
     445        return source(e);
     446      }
     447      /// Running node of the iterator
     448      ///
     449      /// Returns the running node (the target in this case) of the
     450      /// iterator
     451      Node runningNode(OutEdgeIt e) const {
     452        return target(e);
     453      }
     454
     455      /// Base node of the iterator
     456      ///
     457      /// Returns the base node (the target in this case) of the iterator
     458      Node baseNode(InEdgeIt e) const {
     459        return target(e);
     460      }
     461      /// Running node of the iterator
     462      ///
     463      /// Returns the running node (the source in this case) of the
     464      /// iterator
     465      Node runningNode(InEdgeIt e) const {
     466        return source(e);
     467      }
     468
     469      /// Base node of the iterator
     470      ///
     471      /// Returns the base node of the iterator
     472      Node baseNode(IncEdgeIt e) const {
     473        return INVALID;
     474      }
     475      /// Running node of the iterator
     476      ///
     477      /// Returns the running node of the iterator
     478      Node runningNode(IncEdgeIt e) const {
     479        return INVALID;
     480      }
     481
     482
    433483      template <typename Graph>
    434484      struct Constraints {
Note: See TracChangeset for help on using the changeset viewer.