Unionfind changes induced some bugs here. Also some augmentations made.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 /// \ingroup graph_concepts
21 /// \brief Undirected bipartite graphs and components of.
24 #ifndef LEMON_CONCEPT_BPUGRAPH_H
25 #define LEMON_CONCEPT_BPUGRAPH_H
27 #include <lemon/concept/graph_component.h>
29 #include <lemon/concept/graph.h>
30 #include <lemon/concept/ugraph.h>
32 #include <lemon/bits/utility.h>
37 /// \addtogroup graph_concepts
41 /// \brief Class describing the concept of Bipartite Undirected Graphs.
43 /// This class describes the common interface of all
44 /// Undirected Bipartite Graphs.
46 /// As all concept describing classes it provides only interface
47 /// without any sensible implementation. So any algorithm for
48 /// bipartite undirected graph should compile with this class, but it
49 /// will not run properly, of course.
51 /// In LEMON bipartite undirected graphs also fulfill the concept of
52 /// the undirected graphs (\ref lemon::concept::UGraph "UGraph Concept").
54 /// You can assume that all undirected bipartite graph can be handled
55 /// as an undirected graph and consequently as a static graph.
57 /// The bipartite graph stores two types of nodes which are named
58 /// ANode and BNode. The graph type contains two types ANode and BNode
59 /// which are inherited from Node type. Moreover they have
60 /// constructor which converts Node to either ANode or BNode when it is
61 /// possible. Therefor everywhere the Node type can be used instead of
62 /// ANode and BNode. So the usage of the ANode and BNode is suggested.
64 /// The iteration on the partition can be done with the ANodeIt and
65 /// BNodeIt classes. The node map can be used to map values to the nodes
66 /// and similarly we can use to map values for just the ANodes and
67 /// BNodes the ANodeMap and BNodeMap template classes.
71 /// \todo undocumented
73 typedef True UndirectedTag;
75 /// \brief The base type of node iterators,
76 /// or in other words, the trivial node iterator.
78 /// This is the base type of each node iterator,
79 /// thus each kind of node iterator converts to this.
80 /// More precisely each kind of node iterator should be inherited
81 /// from the trivial node iterator. The Node class represents
82 /// both of two types of nodes.
85 /// Default constructor
87 /// @warning The default constructor sets the iterator
88 /// to an undefined value.
96 /// Invalid constructor \& conversion.
98 /// This constructor initializes the iterator to be invalid.
99 /// \sa Invalid for more details.
101 /// Equality operator
103 /// Two iterators are equal if and only if they point to the
104 /// same object or both are invalid.
105 bool operator==(Node) const { return true; }
107 /// Inequality operator
109 /// \sa operator==(Node n)
111 bool operator!=(Node) const { return true; }
113 /// Artificial ordering operator.
115 /// To allow the use of graph descriptors as key type in std::map or
116 /// similar associative container we require this.
118 /// \note This operator only have to define some strict ordering of
119 /// the items; this order has nothing to do with the iteration
120 /// ordering of the items.
122 /// \bug This is a technical requirement. Do we really need this?
123 bool operator<(Node) const { return false; }
127 /// \brief The base type of anode iterators,
128 /// or in other words, the trivial anode iterator.
130 /// This is the base type of each anode iterator,
131 /// thus each kind of anode iterator converts to this.
132 /// More precisely each kind of node iterator should be inherited
133 /// from the trivial anode iterator. The ANode class should be used
134 /// only in special cases. Usually the Node type should be used insted
138 /// Default constructor
140 /// @warning The default constructor sets the iterator
141 /// to an undefined value.
143 /// Copy constructor.
145 /// Copy constructor.
147 ANode(const ANode&) { }
149 /// Construct the same node as ANode.
151 /// Construct the same node as ANode. It may throws assertion
152 /// when the given node is from the BNode set.
153 ANode(const Node&) { }
155 /// Invalid constructor \& conversion.
157 /// This constructor initializes the iterator to be invalid.
158 /// \sa Invalid for more details.
160 /// Equality operator
162 /// Two iterators are equal if and only if they point to the
163 /// same object or both are invalid.
164 bool operator==(ANode) const { return true; }
166 /// Inequality operator
168 /// \sa operator==(ANode n)
170 bool operator!=(ANode) const { return true; }
172 /// Artificial ordering operator.
174 /// To allow the use of graph descriptors as key type in std::map or
175 /// similar associative container we require this.
177 /// \note This operator only have to define some strict ordering of
178 /// the items; this order has nothing to do with the iteration
179 /// ordering of the items.
180 bool operator<(ANode) const { return false; }
184 /// \brief The base type of bnode iterators,
185 /// or in other words, the trivial bnode iterator.
187 /// This is the base type of each anode iterator,
188 /// thus each kind of anode iterator converts to this.
189 /// More precisely each kind of node iterator should be inherited
190 /// from the trivial anode iterator. The BNode class should be used
191 /// only in special cases. Usually the Node type should be used insted
195 /// Default constructor
197 /// @warning The default constructor sets the iterator
198 /// to an undefined value.
200 /// Copy constructor.
202 /// Copy constructor.
204 BNode(const BNode&) { }
206 /// Construct the same node as BNode.
208 /// Construct the same node as BNode. It may throws assertion
209 /// when the given node is from the ANode set.
210 BNode(const Node&) { }
212 /// Invalid constructor \& conversion.
214 /// This constructor initializes the iterator to be invalid.
215 /// \sa Invalid for more details.
217 /// Equality operator
219 /// Two iterators are equal if and only if they point to the
220 /// same object or both are invalid.
221 bool operator==(BNode) const { return true; }
223 /// Inequality operator
225 /// \sa operator==(BNode n)
227 bool operator!=(BNode) const { return true; }
229 /// Artificial ordering operator.
231 /// To allow the use of graph descriptors as key type in std::map or
232 /// similar associative container we require this.
234 /// \note This operator only have to define some strict ordering of
235 /// the items; this order has nothing to do with the iteration
236 /// ordering of the items.
237 bool operator<(BNode) const { return false; }
241 /// This iterator goes through each node.
243 /// This iterator goes through each node.
244 /// Its usage is quite simple, for example you can count the number
245 /// of nodes in graph \c g of type \c Graph like this:
248 /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
250 class NodeIt : public Node {
252 /// Default constructor
254 /// @warning The default constructor sets the iterator
255 /// to an undefined value.
257 /// Copy constructor.
259 /// Copy constructor.
261 NodeIt(const NodeIt& n) : Node(n) { }
262 /// Invalid constructor \& conversion.
264 /// Initialize the iterator to be invalid.
265 /// \sa Invalid for more details.
267 /// Sets the iterator to the first node.
269 /// Sets the iterator to the first node of \c g.
271 NodeIt(const BpUGraph&) { }
272 /// Node -> NodeIt conversion.
274 /// Sets the iterator to the node of \c the graph pointed by
275 /// the trivial iterator.
276 /// This feature necessitates that each time we
277 /// iterate the edge-set, the iteration order is the same.
278 NodeIt(const BpUGraph&, const Node&) { }
281 /// Assign the iterator to the next node.
283 NodeIt& operator++() { return *this; }
286 /// This iterator goes through each ANode.
288 /// This iterator goes through each ANode.
289 /// Its usage is quite simple, for example you can count the number
290 /// of nodes in graph \c g of type \c Graph like this:
293 /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
295 class ANodeIt : public ANode {
297 /// Default constructor
299 /// @warning The default constructor sets the iterator
300 /// to an undefined value.
302 /// Copy constructor.
304 /// Copy constructor.
306 ANodeIt(const ANodeIt& n) : Node(n) { }
307 /// Invalid constructor \& conversion.
309 /// Initialize the iterator to be invalid.
310 /// \sa Invalid for more details.
312 /// Sets the iterator to the first node.
314 /// Sets the iterator to the first node of \c g.
316 ANodeIt(const BpUGraph&) { }
317 /// Node -> ANodeIt conversion.
319 /// Sets the iterator to the node of \c the graph pointed by
320 /// the trivial iterator.
321 /// This feature necessitates that each time we
322 /// iterate the edge-set, the iteration order is the same.
323 ANodeIt(const BpUGraph&, const Node&) { }
326 /// Assign the iterator to the next node.
328 ANodeIt& operator++() { return *this; }
331 /// This iterator goes through each BNode.
333 /// This iterator goes through each BNode.
334 /// Its usage is quite simple, for example you can count the number
335 /// of nodes in graph \c g of type \c Graph like this:
338 /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
340 class BNodeIt : public BNode {
342 /// Default constructor
344 /// @warning The default constructor sets the iterator
345 /// to an undefined value.
347 /// Copy constructor.
349 /// Copy constructor.
351 BNodeIt(const BNodeIt& n) : Node(n) { }
352 /// Invalid constructor \& conversion.
354 /// Initialize the iterator to be invalid.
355 /// \sa Invalid for more details.
357 /// Sets the iterator to the first node.
359 /// Sets the iterator to the first node of \c g.
361 BNodeIt(const BpUGraph&) { }
362 /// Node -> BNodeIt conversion.
364 /// Sets the iterator to the node of \c the graph pointed by
365 /// the trivial iterator.
366 /// This feature necessitates that each time we
367 /// iterate the edge-set, the iteration order is the same.
368 BNodeIt(const BpUGraph&, const Node&) { }
371 /// Assign the iterator to the next node.
373 BNodeIt& operator++() { return *this; }
377 /// The base type of the undirected edge iterators.
379 /// The base type of the undirected edge iterators.
383 /// Default constructor
385 /// @warning The default constructor sets the iterator
386 /// to an undefined value.
388 /// Copy constructor.
390 /// Copy constructor.
392 UEdge(const UEdge&) { }
393 /// Initialize the iterator to be invalid.
395 /// Initialize the iterator to be invalid.
398 /// Equality operator
400 /// Two iterators are equal if and only if they point to the
401 /// same object or both are invalid.
402 bool operator==(UEdge) const { return true; }
403 /// Inequality operator
405 /// \sa operator==(UEdge n)
407 bool operator!=(UEdge) const { return true; }
409 /// Artificial ordering operator.
411 /// To allow the use of graph descriptors as key type in std::map or
412 /// similar associative container we require this.
414 /// \note This operator only have to define some strict ordering of
415 /// the items; this order has nothing to do with the iteration
416 /// ordering of the items.
418 /// \bug This is a technical requirement. Do we really need this?
419 bool operator<(UEdge) const { return false; }
422 /// This iterator goes through each undirected edge.
424 /// This iterator goes through each undirected edge of a graph.
425 /// Its usage is quite simple, for example you can count the number
426 /// of undirected edges in a graph \c g of type \c Graph as follows:
429 /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
431 class UEdgeIt : public UEdge {
433 /// Default constructor
435 /// @warning The default constructor sets the iterator
436 /// to an undefined value.
438 /// Copy constructor.
440 /// Copy constructor.
442 UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
443 /// Initialize the iterator to be invalid.
445 /// Initialize the iterator to be invalid.
448 /// This constructor sets the iterator to the first undirected edge.
450 /// This constructor sets the iterator to the first undirected edge.
451 UEdgeIt(const BpUGraph&) { }
452 /// UEdge -> UEdgeIt conversion
454 /// Sets the iterator to the value of the trivial iterator.
455 /// This feature necessitates that each time we
456 /// iterate the undirected edge-set, the iteration order is the
458 UEdgeIt(const BpUGraph&, const UEdge&) { }
459 /// Next undirected edge
461 /// Assign the iterator to the next undirected edge.
462 UEdgeIt& operator++() { return *this; }
465 /// \brief This iterator goes trough the incident undirected
468 /// This iterator goes trough the incident undirected edges
469 /// of a certain node
471 /// Its usage is quite simple, for example you can compute the
472 /// degree (i.e. count the number
473 /// of incident edges of a node \c n
474 /// in graph \c g of type \c Graph as follows.
477 /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
479 class IncEdgeIt : public UEdge {
481 /// Default constructor
483 /// @warning The default constructor sets the iterator
484 /// to an undefined value.
486 /// Copy constructor.
488 /// Copy constructor.
490 IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
491 /// Initialize the iterator to be invalid.
493 /// Initialize the iterator to be invalid.
495 IncEdgeIt(Invalid) { }
496 /// This constructor sets the iterator to first incident edge.
498 /// This constructor set the iterator to the first incident edge of
500 IncEdgeIt(const BpUGraph&, const Node&) { }
501 /// UEdge -> IncEdgeIt conversion
503 /// Sets the iterator to the value of the trivial iterator \c e.
504 /// This feature necessitates that each time we
505 /// iterate the edge-set, the iteration order is the same.
506 IncEdgeIt(const BpUGraph&, const UEdge&) { }
507 /// Next incident edge
509 /// Assign the iterator to the next incident edge
510 /// of the corresponding node.
511 IncEdgeIt& operator++() { return *this; }
514 /// The directed edge type.
516 /// The directed edge type. It can be converted to the
518 class Edge : public UEdge {
520 /// Default constructor
522 /// @warning The default constructor sets the iterator
523 /// to an undefined value.
525 /// Copy constructor.
527 /// Copy constructor.
529 Edge(const Edge& e) : UEdge(e) { }
530 /// Initialize the iterator to be invalid.
532 /// Initialize the iterator to be invalid.
535 /// Equality operator
537 /// Two iterators are equal if and only if they point to the
538 /// same object or both are invalid.
539 bool operator==(Edge) const { return true; }
540 /// Inequality operator
542 /// \sa operator==(Edge n)
544 bool operator!=(Edge) const { return true; }
546 /// Artificial ordering operator.
548 /// To allow the use of graph descriptors as key type in std::map or
549 /// similar associative container we require this.
551 /// \note This operator only have to define some strict ordering of
552 /// the items; this order has nothing to do with the iteration
553 /// ordering of the items.
555 /// \bug This is a technical requirement. Do we really need this?
556 bool operator<(Edge) const { return false; }
559 /// This iterator goes through each directed edge.
561 /// This iterator goes through each edge of a graph.
562 /// Its usage is quite simple, for example you can count the number
563 /// of edges in a graph \c g of type \c Graph as follows:
566 /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
568 class EdgeIt : public Edge {
570 /// Default constructor
572 /// @warning The default constructor sets the iterator
573 /// to an undefined value.
575 /// Copy constructor.
577 /// Copy constructor.
579 EdgeIt(const EdgeIt& e) : Edge(e) { }
580 /// Initialize the iterator to be invalid.
582 /// Initialize the iterator to be invalid.
585 /// This constructor sets the iterator to the first edge.
587 /// This constructor sets the iterator to the first edge of \c g.
588 ///@param g the graph
589 EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
590 /// Edge -> EdgeIt conversion
592 /// Sets the iterator to the value of the trivial iterator \c e.
593 /// This feature necessitates that each time we
594 /// iterate the edge-set, the iteration order is the same.
595 EdgeIt(const BpUGraph&, const Edge&) { }
598 /// Assign the iterator to the next edge.
599 EdgeIt& operator++() { return *this; }
602 /// This iterator goes trough the outgoing directed edges of a node.
604 /// This iterator goes trough the \e outgoing edges of a certain node
606 /// Its usage is quite simple, for example you can count the number
607 /// of outgoing edges of a node \c n
608 /// in graph \c g of type \c Graph as follows.
611 /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
614 class OutEdgeIt : public Edge {
616 /// Default constructor
618 /// @warning The default constructor sets the iterator
619 /// to an undefined value.
621 /// Copy constructor.
623 /// Copy constructor.
625 OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
626 /// Initialize the iterator to be invalid.
628 /// Initialize the iterator to be invalid.
630 OutEdgeIt(Invalid) { }
631 /// This constructor sets the iterator to the first outgoing edge.
633 /// This constructor sets the iterator to the first outgoing edge of
636 ///@param g the graph
637 OutEdgeIt(const BpUGraph& n, const Node& g) {
638 ignore_unused_variable_warning(n);
639 ignore_unused_variable_warning(g);
641 /// Edge -> OutEdgeIt conversion
643 /// Sets the iterator to the value of the trivial iterator.
644 /// This feature necessitates that each time we
645 /// iterate the edge-set, the iteration order is the same.
646 OutEdgeIt(const BpUGraph&, const Edge&) { }
647 ///Next outgoing edge
649 /// Assign the iterator to the next
650 /// outgoing edge of the corresponding node.
651 OutEdgeIt& operator++() { return *this; }
654 /// This iterator goes trough the incoming directed edges of a node.
656 /// This iterator goes trough the \e incoming edges of a certain node
658 /// Its usage is quite simple, for example you can count the number
659 /// of outgoing edges of a node \c n
660 /// in graph \c g of type \c Graph as follows.
663 /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
666 class InEdgeIt : public Edge {
668 /// Default constructor
670 /// @warning The default constructor sets the iterator
671 /// to an undefined value.
673 /// Copy constructor.
675 /// Copy constructor.
677 InEdgeIt(const InEdgeIt& e) : Edge(e) { }
678 /// Initialize the iterator to be invalid.
680 /// Initialize the iterator to be invalid.
682 InEdgeIt(Invalid) { }
683 /// This constructor sets the iterator to first incoming edge.
685 /// This constructor set the iterator to the first incoming edge of
688 ///@param g the graph
689 InEdgeIt(const BpUGraph& g, const Node& n) {
690 ignore_unused_variable_warning(n);
691 ignore_unused_variable_warning(g);
693 /// Edge -> InEdgeIt conversion
695 /// Sets the iterator to the value of the trivial iterator \c e.
696 /// This feature necessitates that each time we
697 /// iterate the edge-set, the iteration order is the same.
698 InEdgeIt(const BpUGraph&, const Edge&) { }
699 /// Next incoming edge
701 /// Assign the iterator to the next inedge of the corresponding node.
703 InEdgeIt& operator++() { return *this; }
706 /// \brief Read write map of the nodes to type \c T.
708 /// ReadWrite map of the nodes to type \c T.
710 /// \warning Making maps that can handle bool type (NodeMap<bool>)
711 /// needs some extra attention!
712 /// \todo Wrong documentation
714 class NodeMap : public ReadWriteMap< Node, T >
719 NodeMap(const BpUGraph&) { }
721 NodeMap(const BpUGraph&, T) { }
724 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
725 ///Assignment operator
726 NodeMap& operator=(const NodeMap&) { return *this; }
727 // \todo fix this concept
730 /// \brief Read write map of the ANodes to type \c T.
732 /// ReadWrite map of the ANodes to type \c T.
734 /// \warning Making maps that can handle bool type (NodeMap<bool>)
735 /// needs some extra attention!
736 /// \todo Wrong documentation
738 class ANodeMap : public ReadWriteMap< Node, T >
743 ANodeMap(const BpUGraph&) { }
745 ANodeMap(const BpUGraph&, T) { }
748 ANodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
749 ///Assignment operator
750 ANodeMap& operator=(const NodeMap&) { return *this; }
751 // \todo fix this concept
754 /// \brief Read write map of the BNodes to type \c T.
756 /// ReadWrite map of the BNodes to type \c T.
758 /// \warning Making maps that can handle bool type (NodeMap<bool>)
759 /// needs some extra attention!
760 /// \todo Wrong documentation
762 class BNodeMap : public ReadWriteMap< Node, T >
767 BNodeMap(const BpUGraph&) { }
769 BNodeMap(const BpUGraph&, T) { }
772 BNodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
773 ///Assignment operator
774 BNodeMap& operator=(const NodeMap&) { return *this; }
775 // \todo fix this concept
778 /// \brief Read write map of the directed edges to type \c T.
780 /// Reference map of the directed edges to type \c T.
782 /// \warning Making maps that can handle bool type (EdgeMap<bool>)
783 /// needs some extra attention!
784 /// \todo Wrong documentation
786 class EdgeMap : public ReadWriteMap<Edge,T>
791 EdgeMap(const BpUGraph&) { }
793 EdgeMap(const BpUGraph&, T) { }
795 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
796 ///Assignment operator
797 EdgeMap& operator=(const EdgeMap&) { return *this; }
798 // \todo fix this concept
801 /// Read write map of the undirected edges to type \c T.
803 /// Reference map of the edges to type \c T.
805 /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
806 /// needs some extra attention!
807 /// \todo Wrong documentation
809 class UEdgeMap : public ReadWriteMap<UEdge,T>
814 UEdgeMap(const BpUGraph&) { }
816 UEdgeMap(const BpUGraph&, T) { }
818 UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
819 ///Assignment operator
820 UEdgeMap &operator=(const UEdgeMap&) { return *this; }
821 // \todo fix this concept
824 /// \brief Direct the given undirected edge.
826 /// Direct the given undirected edge. The returned edge source
827 /// will be the given edge.
828 Edge direct(const UEdge&, const Node&) const {
832 /// \brief Direct the given undirected edge.
834 /// Direct the given undirected edge. The returned edge source
835 /// will be the source of the undirected edge if the given bool
837 Edge direct(const UEdge&, bool) const {
841 /// \brief Returns true when the given node is an ANode.
843 /// Returns true when the given node is an ANode.
844 bool aNode(Node) const { return true;}
846 /// \brief Returns true when the given node is an BNode.
848 /// Returns true when the given node is an BNode.
849 bool bNode(Node) const { return true;}
851 /// \brief Returns the edge's end node which is in the ANode set.
853 /// Returns the edge's end node which is in the ANode set.
854 Node aNode(UEdge) const { return INVALID;}
856 /// \brief Returns the edge's end node which is in the BNode set.
858 /// Returns the edge's end node which is in the BNode set.
859 Node bNode(UEdge) const { return INVALID;}
861 /// \brief Returns true if the edge has default orientation.
863 /// Returns whether the given directed edge is same orientation as
864 /// the corresponding undirected edge.
865 bool direction(Edge) const { return true; }
867 /// \brief Returns the opposite directed edge.
869 /// Returns the opposite directed edge.
870 Edge oppositeEdge(Edge) const { return INVALID; }
872 /// \brief Opposite node on an edge
874 /// \return the opposite of the given Node on the given Edge
875 Node oppositeNode(Node, UEdge) const { return INVALID; }
877 /// \brief First node of the undirected edge.
879 /// \return the first node of the given UEdge.
881 /// Naturally uectected edges don't have direction and thus
882 /// don't have source and target node. But we use these two methods
883 /// to query the two endnodes of the edge. The direction of the edge
884 /// which arises this way is called the inherent direction of the
885 /// undirected edge, and is used to define the "default" direction
886 /// of the directed versions of the edges.
888 Node source(UEdge) const { return INVALID; }
890 /// \brief Second node of the undirected edge.
891 Node target(UEdge) const { return INVALID; }
893 /// \brief Source node of the directed edge.
894 Node source(Edge) const { return INVALID; }
896 /// \brief Target node of the directed edge.
897 Node target(Edge) const { return INVALID; }
899 /// \brief Base node of the iterator
901 /// Returns the base node (the source in this case) of the iterator
902 Node baseNode(OutEdgeIt e) const {
906 /// \brief Running node of the iterator
908 /// Returns the running node (the target in this case) of the
910 Node runningNode(OutEdgeIt e) const {
914 /// \brief Base node of the iterator
916 /// Returns the base node (the target in this case) of the iterator
917 Node baseNode(InEdgeIt e) const {
920 /// \brief Running node of the iterator
922 /// Returns the running node (the source in this case) of the
924 Node runningNode(InEdgeIt e) const {
928 /// \brief Base node of the iterator
930 /// Returns the base node of the iterator
931 Node baseNode(IncEdgeIt) const {
935 /// \brief Running node of the iterator
937 /// Returns the running node of the iterator
938 Node runningNode(IncEdgeIt) const {
942 template <typename Graph>
950 /// \brief An empty non-static undirected graph class.
952 /// This class provides everything that \ref BpUGraph does.
953 /// Additionally it enables building graphs from scratch.
954 class ExtendableBpUGraph : public BpUGraph {
957 /// \brief Add a new ANode to the graph.
959 /// Add a new ANode to the graph.
960 /// \return the new node.
963 /// \brief Add a new ANode to the graph.
965 /// Add a new ANode to the graph.
966 /// \return the new node.
969 /// \brief Add a new undirected edge to the graph.
971 /// Add a new undirected edge to the graph. One of the nodes
972 /// should be ANode and the other should be BNode.
973 /// \pre The nodes are not in the same nodeset.
974 /// \return the new edge.
975 UEdge addEdge(const Node& from, const Node& to);
977 /// \brief Resets the graph.
979 /// This function deletes all undirected edges and nodes of the graph.
980 /// It also frees the memory allocated to store them.
983 template <typename Graph>
985 void constraints() {}
990 /// \brief An empty erasable undirected graph class.
992 /// This class is an extension of \ref ExtendableBpUGraph. It makes it
993 /// possible to erase undirected edges or nodes.
994 class ErasableBpUGraph : public ExtendableBpUGraph {
997 /// \brief Deletes a node.
1001 void erase(Node) { }
1002 /// \brief Deletes an undirected edge.
1004 /// Deletes an undirected edge.
1006 void erase(UEdge) { }
1008 template <typename Graph>
1009 struct Constraints {
1010 void constraints() {}