18 |
18 |
19 ///\ingroup graph_concepts |
19 ///\ingroup graph_concepts |
20 ///\file |
20 ///\file |
21 ///\brief The concept of graph components. |
21 ///\brief The concept of graph components. |
22 |
22 |
23 |
|
24 #ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H |
23 #ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H |
25 #define LEMON_CONCEPTS_GRAPH_COMPONENTS_H |
24 #define LEMON_CONCEPTS_GRAPH_COMPONENTS_H |
26 |
25 |
27 #include <lemon/core.h> |
26 #include <lemon/core.h> |
28 #include <lemon/concepts/maps.h> |
27 #include <lemon/concepts/maps.h> |
294 /// |
293 /// |
295 /// This class provides beside the core digraph features |
294 /// This class provides beside the core digraph features |
296 /// core id functions for the digraph structure. |
295 /// core id functions for the digraph structure. |
297 /// The most of the base digraphs should conform to this concept. |
296 /// The most of the base digraphs should conform to this concept. |
298 /// The id's are unique and immutable. |
297 /// The id's are unique and immutable. |
299 template <typename _Base = BaseDigraphComponent> |
298 template <typename BAS = BaseDigraphComponent> |
300 class IDableDigraphComponent : public _Base { |
299 class IDableDigraphComponent : public BAS { |
301 public: |
300 public: |
302 |
301 |
303 typedef _Base Base; |
302 typedef BAS Base; |
304 typedef typename Base::Node Node; |
303 typedef typename Base::Node Node; |
305 typedef typename Base::Arc Arc; |
304 typedef typename Base::Arc Arc; |
306 |
305 |
307 /// \brief Gives back an unique integer id for the Node. |
306 /// \brief Gives back an unique integer id for the Node. |
308 /// |
307 /// |
372 /// |
371 /// |
373 /// This class provides beside the core undirected graph features |
372 /// This class provides beside the core undirected graph features |
374 /// core id functions for the undirected graph structure. The |
373 /// core id functions for the undirected graph structure. The |
375 /// most of the base undirected graphs should conform to this |
374 /// most of the base undirected graphs should conform to this |
376 /// concept. The id's are unique and immutable. |
375 /// concept. The id's are unique and immutable. |
377 template <typename _Base = BaseGraphComponent> |
376 template <typename BAS = BaseGraphComponent> |
378 class IDableGraphComponent : public IDableDigraphComponent<_Base> { |
377 class IDableGraphComponent : public IDableDigraphComponent<BAS> { |
379 public: |
378 public: |
380 |
379 |
381 typedef _Base Base; |
380 typedef BAS Base; |
382 typedef typename Base::Edge Edge; |
381 typedef typename Base::Edge Edge; |
383 |
382 |
384 using IDableDigraphComponent<_Base>::id; |
383 using IDableDigraphComponent<Base>::id; |
385 |
384 |
386 /// \brief Gives back an unique integer id for the Edge. |
385 /// \brief Gives back an unique integer id for the Edge. |
387 /// |
386 /// |
388 /// Gives back an unique integer id for the Edge. |
387 /// Gives back an unique integer id for the Edge. |
389 /// |
388 /// |
423 |
422 |
424 /// \brief Skeleton class for graph NodeIt and ArcIt |
423 /// \brief Skeleton class for graph NodeIt and ArcIt |
425 /// |
424 /// |
426 /// Skeleton class for graph NodeIt and ArcIt. |
425 /// Skeleton class for graph NodeIt and ArcIt. |
427 /// |
426 /// |
428 template <typename _Graph, typename _Item> |
427 template <typename GR, typename Item> |
429 class GraphItemIt : public _Item { |
428 class GraphItemIt : public Item { |
430 public: |
429 public: |
431 /// \brief Default constructor. |
430 /// \brief Default constructor. |
432 /// |
431 /// |
433 /// @warning The default constructor sets the iterator |
432 /// @warning The default constructor sets the iterator |
434 /// to an undefined value. |
433 /// to an undefined value. |
440 GraphItemIt(const GraphItemIt& ) {} |
439 GraphItemIt(const GraphItemIt& ) {} |
441 /// \brief Sets the iterator to the first item. |
440 /// \brief Sets the iterator to the first item. |
442 /// |
441 /// |
443 /// Sets the iterator to the first item of \c the graph. |
442 /// Sets the iterator to the first item of \c the graph. |
444 /// |
443 /// |
445 explicit GraphItemIt(const _Graph&) {} |
444 explicit GraphItemIt(const GR&) {} |
446 /// \brief Invalid constructor \& conversion. |
445 /// \brief Invalid constructor \& conversion. |
447 /// |
446 /// |
448 /// This constructor initializes the item to be invalid. |
447 /// This constructor initializes the item to be invalid. |
449 /// \sa Invalid for more details. |
448 /// \sa Invalid for more details. |
450 GraphItemIt(Invalid) {} |
449 GraphItemIt(Invalid) {} |
477 |
476 |
478 it2 = ++it1; |
477 it2 = ++it1; |
479 ++it2 = it1; |
478 ++it2 = it1; |
480 ++(++it1); |
479 ++(++it1); |
481 |
480 |
482 _Item bi = it1; |
481 Item bi = it1; |
483 bi = it2; |
482 bi = it2; |
484 } |
483 } |
485 _Graph& g; |
484 GR& g; |
486 }; |
485 }; |
487 }; |
486 }; |
488 |
487 |
489 /// \brief Skeleton class for graph InArcIt and OutArcIt |
488 /// \brief Skeleton class for graph InArcIt and OutArcIt |
490 /// |
489 /// |
491 /// \note Because InArcIt and OutArcIt may not inherit from the same |
490 /// \note Because InArcIt and OutArcIt may not inherit from the same |
492 /// base class, the _selector is a additional template parameter. For |
491 /// base class, the \c sel is a additional template parameter (selector). |
493 /// InArcIt you should instantiate it with character 'i' and for |
492 /// For InArcIt you should instantiate it with character 'i' and for |
494 /// OutArcIt with 'o'. |
493 /// OutArcIt with 'o'. |
495 template <typename _Graph, |
494 template <typename GR, |
496 typename _Item = typename _Graph::Arc, |
495 typename Item = typename GR::Arc, |
497 typename _Base = typename _Graph::Node, |
496 typename Base = typename GR::Node, |
498 char _selector = '0'> |
497 char sel = '0'> |
499 class GraphIncIt : public _Item { |
498 class GraphIncIt : public Item { |
500 public: |
499 public: |
501 /// \brief Default constructor. |
500 /// \brief Default constructor. |
502 /// |
501 /// |
503 /// @warning The default constructor sets the iterator |
502 /// @warning The default constructor sets the iterator |
504 /// to an undefined value. |
503 /// to an undefined value. |
505 GraphIncIt() {} |
504 GraphIncIt() {} |
506 /// \brief Copy constructor. |
505 /// \brief Copy constructor. |
507 /// |
506 /// |
508 /// Copy constructor. |
507 /// Copy constructor. |
509 /// |
508 /// |
510 GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} |
509 GraphIncIt(GraphIncIt const& gi) : Item(gi) {} |
511 /// \brief Sets the iterator to the first arc incoming into or outgoing |
510 /// \brief Sets the iterator to the first arc incoming into or outgoing |
512 /// from the node. |
511 /// from the node. |
513 /// |
512 /// |
514 /// Sets the iterator to the first arc incoming into or outgoing |
513 /// Sets the iterator to the first arc incoming into or outgoing |
515 /// from the node. |
514 /// from the node. |
516 /// |
515 /// |
517 explicit GraphIncIt(const _Graph&, const _Base&) {} |
516 explicit GraphIncIt(const GR&, const Base&) {} |
518 /// \brief Invalid constructor \& conversion. |
517 /// \brief Invalid constructor \& conversion. |
519 /// |
518 /// |
520 /// This constructor initializes the item to be invalid. |
519 /// This constructor initializes the item to be invalid. |
521 /// \sa Invalid for more details. |
520 /// \sa Invalid for more details. |
522 GraphIncIt(Invalid) {} |
521 GraphIncIt(Invalid) {} |
544 bool operator!=(const GraphIncIt&) const { return true;} |
543 bool operator!=(const GraphIncIt&) const { return true;} |
545 |
544 |
546 template <typename _GraphIncIt> |
545 template <typename _GraphIncIt> |
547 struct Constraints { |
546 struct Constraints { |
548 void constraints() { |
547 void constraints() { |
549 checkConcept<GraphItem<_selector>, _GraphIncIt>(); |
548 checkConcept<GraphItem<sel>, _GraphIncIt>(); |
550 _GraphIncIt it1(graph, node); |
549 _GraphIncIt it1(graph, node); |
551 _GraphIncIt it2; |
550 _GraphIncIt it2; |
552 |
551 |
553 it2 = ++it1; |
552 it2 = ++it1; |
554 ++it2 = it1; |
553 ++it2 = it1; |
555 ++(++it1); |
554 ++(++it1); |
556 _Item e = it1; |
555 Item e = it1; |
557 e = it2; |
556 e = it2; |
558 |
557 |
559 } |
558 } |
560 |
559 |
561 _Item arc; |
560 Item arc; |
562 _Base node; |
561 Base node; |
563 _Graph graph; |
562 GR graph; |
564 _GraphIncIt it; |
563 _GraphIncIt it; |
565 }; |
564 }; |
566 }; |
565 }; |
567 |
566 |
568 |
567 |
569 /// \brief An empty iterable digraph class. |
568 /// \brief An empty iterable digraph class. |
570 /// |
569 /// |
571 /// This class provides beside the core digraph features |
570 /// This class provides beside the core digraph features |
572 /// iterator based iterable interface for the digraph structure. |
571 /// iterator based iterable interface for the digraph structure. |
573 /// This concept is part of the Digraph concept. |
572 /// This concept is part of the Digraph concept. |
574 template <typename _Base = BaseDigraphComponent> |
573 template <typename BAS = BaseDigraphComponent> |
575 class IterableDigraphComponent : public _Base { |
574 class IterableDigraphComponent : public BAS { |
576 |
575 |
577 public: |
576 public: |
578 |
577 |
579 typedef _Base Base; |
578 typedef BAS Base; |
580 typedef typename Base::Node Node; |
579 typedef typename Base::Node Node; |
581 typedef typename Base::Arc Arc; |
580 typedef typename Base::Arc Arc; |
582 |
581 |
583 typedef IterableDigraphComponent Digraph; |
582 typedef IterableDigraphComponent Digraph; |
584 |
583 |
754 /// \brief An empty iterable undirected graph class. |
753 /// \brief An empty iterable undirected graph class. |
755 /// |
754 /// |
756 /// This class provides beside the core graph features iterator |
755 /// This class provides beside the core graph features iterator |
757 /// based iterable interface for the undirected graph structure. |
756 /// based iterable interface for the undirected graph structure. |
758 /// This concept is part of the Graph concept. |
757 /// This concept is part of the Graph concept. |
759 template <typename _Base = BaseGraphComponent> |
758 template <typename BAS = BaseGraphComponent> |
760 class IterableGraphComponent : public IterableDigraphComponent<_Base> { |
759 class IterableGraphComponent : public IterableDigraphComponent<BAS> { |
761 public: |
760 public: |
762 |
761 |
763 typedef _Base Base; |
762 typedef BAS Base; |
764 typedef typename Base::Node Node; |
763 typedef typename Base::Node Node; |
765 typedef typename Base::Arc Arc; |
764 typedef typename Base::Arc Arc; |
766 typedef typename Base::Edge Edge; |
765 typedef typename Base::Edge Edge; |
767 |
766 |
768 |
767 |
771 /// \name Base iteration |
770 /// \name Base iteration |
772 /// |
771 /// |
773 /// This interface provides functions for iteration on graph items |
772 /// This interface provides functions for iteration on graph items |
774 /// @{ |
773 /// @{ |
775 |
774 |
776 using IterableDigraphComponent<_Base>::first; |
775 using IterableDigraphComponent<Base>::first; |
777 using IterableDigraphComponent<_Base>::next; |
776 using IterableDigraphComponent<Base>::next; |
778 |
777 |
779 /// \brief Gives back the first edge in the iterating |
778 /// \brief Gives back the first edge in the iterating |
780 /// order. |
779 /// order. |
781 /// |
780 /// |
782 /// Gives back the first edge in the iterating order. |
781 /// Gives back the first edge in the iterating order. |
806 /// Gives back the next of the edges from the given |
805 /// Gives back the next of the edges from the given |
807 /// node. The bool parameter should be used as the \c firstInc() |
806 /// node. The bool parameter should be used as the \c firstInc() |
808 /// use it. |
807 /// use it. |
809 void nextInc(Edge&, bool&) const {} |
808 void nextInc(Edge&, bool&) const {} |
810 |
809 |
811 using IterableDigraphComponent<_Base>::baseNode; |
810 using IterableDigraphComponent<Base>::baseNode; |
812 using IterableDigraphComponent<_Base>::runningNode; |
811 using IterableDigraphComponent<Base>::runningNode; |
813 |
812 |
814 /// @} |
813 /// @} |
815 |
814 |
816 /// \name Class based iteration |
815 /// \name Class based iteration |
817 /// |
816 /// |
885 /// notifier interface for the digraph structure. This implements |
883 /// notifier interface for the digraph structure. This implements |
886 /// an observer-notifier pattern for each digraph item. More |
884 /// an observer-notifier pattern for each digraph item. More |
887 /// obsevers can be registered into the notifier and whenever an |
885 /// obsevers can be registered into the notifier and whenever an |
888 /// alteration occured in the digraph all the observers will |
886 /// alteration occured in the digraph all the observers will |
889 /// notified about it. |
887 /// notified about it. |
890 template <typename _Base = BaseDigraphComponent> |
888 template <typename BAS = BaseDigraphComponent> |
891 class AlterableDigraphComponent : public _Base { |
889 class AlterableDigraphComponent : public BAS { |
892 public: |
890 public: |
893 |
891 |
894 typedef _Base Base; |
892 typedef BAS Base; |
895 typedef typename Base::Node Node; |
893 typedef typename Base::Node Node; |
896 typedef typename Base::Arc Arc; |
894 typedef typename Base::Arc Arc; |
897 |
895 |
898 |
896 |
899 /// The node observer registry. |
897 /// The node observer registry. |
943 /// notifier interface for the graph structure. This implements |
941 /// notifier interface for the graph structure. This implements |
944 /// an observer-notifier pattern for each graph item. More |
942 /// an observer-notifier pattern for each graph item. More |
945 /// obsevers can be registered into the notifier and whenever an |
943 /// obsevers can be registered into the notifier and whenever an |
946 /// alteration occured in the graph all the observers will |
944 /// alteration occured in the graph all the observers will |
947 /// notified about it. |
945 /// notified about it. |
948 template <typename _Base = BaseGraphComponent> |
946 template <typename BAS = BaseGraphComponent> |
949 class AlterableGraphComponent : public AlterableDigraphComponent<_Base> { |
947 class AlterableGraphComponent : public AlterableDigraphComponent<BAS> { |
950 public: |
948 public: |
951 |
949 |
952 typedef _Base Base; |
950 typedef BAS Base; |
953 typedef typename Base::Edge Edge; |
951 typedef typename Base::Edge Edge; |
954 |
952 |
955 |
953 |
956 /// The arc observer registry. |
954 /// The arc observer registry. |
957 typedef AlterationNotifier<AlterableGraphComponent, Edge> |
955 typedef AlterationNotifier<AlterableGraphComponent, Edge> |
972 = graph.notifier(typename _Graph::Edge()); |
970 = graph.notifier(typename _Graph::Edge()); |
973 ignore_unused_variable_warning(uen); |
971 ignore_unused_variable_warning(uen); |
974 } |
972 } |
975 |
973 |
976 const _Graph& graph; |
974 const _Graph& graph; |
977 |
975 }; |
978 }; |
|
979 |
|
980 }; |
976 }; |
981 |
977 |
982 /// \brief Class describing the concept of graph maps |
978 /// \brief Class describing the concept of graph maps |
983 /// |
979 /// |
984 /// This class describes the common interface of the graph maps |
980 /// This class describes the common interface of the graph maps |
985 /// (NodeMap, ArcMap), that is maps that can be used to |
981 /// (NodeMap, ArcMap), that is maps that can be used to |
986 /// associate data to graph descriptors (nodes or arcs). |
982 /// associate data to graph descriptors (nodes or arcs). |
987 template <typename _Graph, typename _Item, typename _Value> |
983 template <typename GR, typename K, typename V> |
988 class GraphMap : public ReadWriteMap<_Item, _Value> { |
984 class GraphMap : public ReadWriteMap<K, V> { |
989 public: |
985 public: |
990 |
986 |
991 typedef ReadWriteMap<_Item, _Value> Parent; |
987 typedef ReadWriteMap<K, V> Parent; |
992 |
988 |
993 /// The graph type of the map. |
989 /// The graph type of the map. |
994 typedef _Graph Graph; |
990 typedef GR Graph; |
995 /// The key type of the map. |
991 /// The key type of the map. |
996 typedef _Item Key; |
992 typedef K Key; |
997 /// The value type of the map. |
993 /// The value type of the map. |
998 typedef _Value Value; |
994 typedef V Value; |
999 |
995 |
1000 /// \brief Construct a new map. |
996 /// \brief Construct a new map. |
1001 /// |
997 /// |
1002 /// Construct a new map for the graph. |
998 /// Construct a new map for the graph. |
1003 explicit GraphMap(const Graph&) {} |
999 explicit GraphMap(const Graph&) {} |
1053 /// \brief An empty mappable digraph class. |
1049 /// \brief An empty mappable digraph class. |
1054 /// |
1050 /// |
1055 /// This class provides beside the core digraph features |
1051 /// This class provides beside the core digraph features |
1056 /// map interface for the digraph structure. |
1052 /// map interface for the digraph structure. |
1057 /// This concept is part of the Digraph concept. |
1053 /// This concept is part of the Digraph concept. |
1058 template <typename _Base = BaseDigraphComponent> |
1054 template <typename BAS = BaseDigraphComponent> |
1059 class MappableDigraphComponent : public _Base { |
1055 class MappableDigraphComponent : public BAS { |
1060 public: |
1056 public: |
1061 |
1057 |
1062 typedef _Base Base; |
1058 typedef BAS Base; |
1063 typedef typename Base::Node Node; |
1059 typedef typename Base::Node Node; |
1064 typedef typename Base::Arc Arc; |
1060 typedef typename Base::Arc Arc; |
1065 |
1061 |
1066 typedef MappableDigraphComponent Digraph; |
1062 typedef MappableDigraphComponent Digraph; |
1067 |
1063 |
1068 /// \brief ReadWrite map of the nodes. |
1064 /// \brief ReadWrite map of the nodes. |
1069 /// |
1065 /// |
1070 /// ReadWrite map of the nodes. |
1066 /// ReadWrite map of the nodes. |
1071 /// |
1067 /// |
1072 template <typename _Value> |
1068 template <typename V> |
1073 class NodeMap : public GraphMap<Digraph, Node, _Value> { |
1069 class NodeMap : public GraphMap<Digraph, Node, V> { |
1074 public: |
1070 public: |
1075 typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent; |
1071 typedef GraphMap<MappableDigraphComponent, Node, V> Parent; |
1076 |
1072 |
1077 /// \brief Construct a new map. |
1073 /// \brief Construct a new map. |
1078 /// |
1074 /// |
1079 /// Construct a new map for the digraph. |
1075 /// Construct a new map for the digraph. |
1080 explicit NodeMap(const MappableDigraphComponent& digraph) |
1076 explicit NodeMap(const MappableDigraphComponent& digraph) |
1081 : Parent(digraph) {} |
1077 : Parent(digraph) {} |
1082 |
1078 |
1083 /// \brief Construct a new map with default value. |
1079 /// \brief Construct a new map with default value. |
1084 /// |
1080 /// |
1085 /// Construct a new map for the digraph and initalise the values. |
1081 /// Construct a new map for the digraph and initalise the values. |
1086 NodeMap(const MappableDigraphComponent& digraph, const _Value& value) |
1082 NodeMap(const MappableDigraphComponent& digraph, const V& value) |
1087 : Parent(digraph, value) {} |
1083 : Parent(digraph, value) {} |
1088 |
1084 |
1089 private: |
1085 private: |
1090 /// \brief Copy constructor. |
1086 /// \brief Copy constructor. |
1091 /// |
1087 /// |
1095 /// \brief Assign operator. |
1091 /// \brief Assign operator. |
1096 /// |
1092 /// |
1097 /// Assign operator. |
1093 /// Assign operator. |
1098 template <typename CMap> |
1094 template <typename CMap> |
1099 NodeMap& operator=(const CMap&) { |
1095 NodeMap& operator=(const CMap&) { |
1100 checkConcept<ReadMap<Node, _Value>, CMap>(); |
1096 checkConcept<ReadMap<Node, V>, CMap>(); |
1101 return *this; |
1097 return *this; |
1102 } |
1098 } |
1103 |
1099 |
1104 }; |
1100 }; |
1105 |
1101 |
1106 /// \brief ReadWrite map of the arcs. |
1102 /// \brief ReadWrite map of the arcs. |
1107 /// |
1103 /// |
1108 /// ReadWrite map of the arcs. |
1104 /// ReadWrite map of the arcs. |
1109 /// |
1105 /// |
1110 template <typename _Value> |
1106 template <typename V> |
1111 class ArcMap : public GraphMap<Digraph, Arc, _Value> { |
1107 class ArcMap : public GraphMap<Digraph, Arc, V> { |
1112 public: |
1108 public: |
1113 typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent; |
1109 typedef GraphMap<MappableDigraphComponent, Arc, V> Parent; |
1114 |
1110 |
1115 /// \brief Construct a new map. |
1111 /// \brief Construct a new map. |
1116 /// |
1112 /// |
1117 /// Construct a new map for the digraph. |
1113 /// Construct a new map for the digraph. |
1118 explicit ArcMap(const MappableDigraphComponent& digraph) |
1114 explicit ArcMap(const MappableDigraphComponent& digraph) |
1119 : Parent(digraph) {} |
1115 : Parent(digraph) {} |
1120 |
1116 |
1121 /// \brief Construct a new map with default value. |
1117 /// \brief Construct a new map with default value. |
1122 /// |
1118 /// |
1123 /// Construct a new map for the digraph and initalise the values. |
1119 /// Construct a new map for the digraph and initalise the values. |
1124 ArcMap(const MappableDigraphComponent& digraph, const _Value& value) |
1120 ArcMap(const MappableDigraphComponent& digraph, const V& value) |
1125 : Parent(digraph, value) {} |
1121 : Parent(digraph, value) {} |
1126 |
1122 |
1127 private: |
1123 private: |
1128 /// \brief Copy constructor. |
1124 /// \brief Copy constructor. |
1129 /// |
1125 /// |
1189 /// \brief An empty mappable base bipartite graph class. |
1185 /// \brief An empty mappable base bipartite graph class. |
1190 /// |
1186 /// |
1191 /// This class provides beside the core graph features |
1187 /// This class provides beside the core graph features |
1192 /// map interface for the graph structure. |
1188 /// map interface for the graph structure. |
1193 /// This concept is part of the Graph concept. |
1189 /// This concept is part of the Graph concept. |
1194 template <typename _Base = BaseGraphComponent> |
1190 template <typename BAS = BaseGraphComponent> |
1195 class MappableGraphComponent : public MappableDigraphComponent<_Base> { |
1191 class MappableGraphComponent : public MappableDigraphComponent<BAS> { |
1196 public: |
1192 public: |
1197 |
1193 |
1198 typedef _Base Base; |
1194 typedef BAS Base; |
1199 typedef typename Base::Edge Edge; |
1195 typedef typename Base::Edge Edge; |
1200 |
1196 |
1201 typedef MappableGraphComponent Graph; |
1197 typedef MappableGraphComponent Graph; |
1202 |
1198 |
1203 /// \brief ReadWrite map of the edges. |
1199 /// \brief ReadWrite map of the edges. |
1204 /// |
1200 /// |
1205 /// ReadWrite map of the edges. |
1201 /// ReadWrite map of the edges. |
1206 /// |
1202 /// |
1207 template <typename _Value> |
1203 template <typename V> |
1208 class EdgeMap : public GraphMap<Graph, Edge, _Value> { |
1204 class EdgeMap : public GraphMap<Graph, Edge, V> { |
1209 public: |
1205 public: |
1210 typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent; |
1206 typedef GraphMap<MappableGraphComponent, Edge, V> Parent; |
1211 |
1207 |
1212 /// \brief Construct a new map. |
1208 /// \brief Construct a new map. |
1213 /// |
1209 /// |
1214 /// Construct a new map for the graph. |
1210 /// Construct a new map for the graph. |
1215 explicit EdgeMap(const MappableGraphComponent& graph) |
1211 explicit EdgeMap(const MappableGraphComponent& graph) |
1216 : Parent(graph) {} |
1212 : Parent(graph) {} |
1217 |
1213 |
1218 /// \brief Construct a new map with default value. |
1214 /// \brief Construct a new map with default value. |
1219 /// |
1215 /// |
1220 /// Construct a new map for the graph and initalise the values. |
1216 /// Construct a new map for the graph and initalise the values. |
1221 EdgeMap(const MappableGraphComponent& graph, const _Value& value) |
1217 EdgeMap(const MappableGraphComponent& graph, const V& value) |
1222 : Parent(graph, value) {} |
1218 : Parent(graph, value) {} |
1223 |
1219 |
1224 private: |
1220 private: |
1225 /// \brief Copy constructor. |
1221 /// \brief Copy constructor. |
1226 /// |
1222 /// |
1230 /// \brief Assign operator. |
1226 /// \brief Assign operator. |
1231 /// |
1227 /// |
1232 /// Assign operator. |
1228 /// Assign operator. |
1233 template <typename CMap> |
1229 template <typename CMap> |
1234 EdgeMap& operator=(const CMap&) { |
1230 EdgeMap& operator=(const CMap&) { |
1235 checkConcept<ReadMap<Edge, _Value>, CMap>(); |
1231 checkConcept<ReadMap<Edge, V>, CMap>(); |
1236 return *this; |
1232 return *this; |
1237 } |
1233 } |
1238 |
1234 |
1239 }; |
1235 }; |
1240 |
1236 |
1274 /// |
1270 /// |
1275 /// This class provides beside the core digraph features digraph |
1271 /// This class provides beside the core digraph features digraph |
1276 /// extendable interface for the digraph structure. The main |
1272 /// extendable interface for the digraph structure. The main |
1277 /// difference between the base and this interface is that the |
1273 /// difference between the base and this interface is that the |
1278 /// digraph alterations should handled already on this level. |
1274 /// digraph alterations should handled already on this level. |
1279 template <typename _Base = BaseDigraphComponent> |
1275 template <typename BAS = BaseDigraphComponent> |
1280 class ExtendableDigraphComponent : public _Base { |
1276 class ExtendableDigraphComponent : public BAS { |
1281 public: |
1277 public: |
1282 typedef _Base Base; |
1278 typedef BAS Base; |
1283 |
1279 |
1284 typedef typename _Base::Node Node; |
1280 typedef typename Base::Node Node; |
1285 typedef typename _Base::Arc Arc; |
1281 typedef typename Base::Arc Arc; |
1286 |
1282 |
1287 /// \brief Adds a new node to the digraph. |
1283 /// \brief Adds a new node to the digraph. |
1288 /// |
1284 /// |
1289 /// Adds a new node to the digraph. |
1285 /// Adds a new node to the digraph. |
1290 /// |
1286 /// |
1319 /// This class provides beside the core undirected graph features |
1315 /// This class provides beside the core undirected graph features |
1320 /// core undircted graph extend interface for the graph structure. |
1316 /// core undircted graph extend interface for the graph structure. |
1321 /// The main difference between the base and this interface is |
1317 /// The main difference between the base and this interface is |
1322 /// that the graph alterations should handled already on this |
1318 /// that the graph alterations should handled already on this |
1323 /// level. |
1319 /// level. |
1324 template <typename _Base = BaseGraphComponent> |
1320 template <typename BAS = BaseGraphComponent> |
1325 class ExtendableGraphComponent : public _Base { |
1321 class ExtendableGraphComponent : public BAS { |
1326 public: |
1322 public: |
1327 |
1323 |
1328 typedef _Base Base; |
1324 typedef BAS Base; |
1329 typedef typename _Base::Node Node; |
1325 typedef typename Base::Node Node; |
1330 typedef typename _Base::Edge Edge; |
1326 typedef typename Base::Edge Edge; |
1331 |
1327 |
1332 /// \brief Adds a new node to the graph. |
1328 /// \brief Adds a new node to the graph. |
1333 /// |
1329 /// |
1334 /// Adds a new node to the graph. |
1330 /// Adds a new node to the graph. |
1335 /// |
1331 /// |
1363 /// |
1359 /// |
1364 /// This class provides beside the core digraph features core erase |
1360 /// This class provides beside the core digraph features core erase |
1365 /// functions for the digraph structure. The main difference between |
1361 /// functions for the digraph structure. The main difference between |
1366 /// the base and this interface is that the digraph alterations |
1362 /// the base and this interface is that the digraph alterations |
1367 /// should handled already on this level. |
1363 /// should handled already on this level. |
1368 template <typename _Base = BaseDigraphComponent> |
1364 template <typename BAS = BaseDigraphComponent> |
1369 class ErasableDigraphComponent : public _Base { |
1365 class ErasableDigraphComponent : public BAS { |
1370 public: |
1366 public: |
1371 |
1367 |
1372 typedef _Base Base; |
1368 typedef BAS Base; |
1373 typedef typename Base::Node Node; |
1369 typedef typename Base::Node Node; |
1374 typedef typename Base::Arc Arc; |
1370 typedef typename Base::Arc Arc; |
1375 |
1371 |
1376 /// \brief Erase a node from the digraph. |
1372 /// \brief Erase a node from the digraph. |
1377 /// |
1373 /// |
1403 /// |
1399 /// |
1404 /// This class provides beside the core undirected graph features |
1400 /// This class provides beside the core undirected graph features |
1405 /// core erase functions for the undirceted graph structure. The |
1401 /// core erase functions for the undirceted graph structure. The |
1406 /// main difference between the base and this interface is that |
1402 /// main difference between the base and this interface is that |
1407 /// the graph alterations should handled already on this level. |
1403 /// the graph alterations should handled already on this level. |
1408 template <typename _Base = BaseGraphComponent> |
1404 template <typename BAS = BaseGraphComponent> |
1409 class ErasableGraphComponent : public _Base { |
1405 class ErasableGraphComponent : public BAS { |
1410 public: |
1406 public: |
1411 |
1407 |
1412 typedef _Base Base; |
1408 typedef BAS Base; |
1413 typedef typename Base::Node Node; |
1409 typedef typename Base::Node Node; |
1414 typedef typename Base::Edge Edge; |
1410 typedef typename Base::Edge Edge; |
1415 |
1411 |
1416 /// \brief Erase a node from the graph. |
1412 /// \brief Erase a node from the graph. |
1417 /// |
1413 /// |
1443 /// |
1439 /// |
1444 /// This class provides beside the core digraph features core clear |
1440 /// This class provides beside the core digraph features core clear |
1445 /// functions for the digraph structure. The main difference between |
1441 /// functions for the digraph structure. The main difference between |
1446 /// the base and this interface is that the digraph alterations |
1442 /// the base and this interface is that the digraph alterations |
1447 /// should handled already on this level. |
1443 /// should handled already on this level. |
1448 template <typename _Base = BaseDigraphComponent> |
1444 template <typename BAS = BaseDigraphComponent> |
1449 class ClearableDigraphComponent : public _Base { |
1445 class ClearableDigraphComponent : public BAS { |
1450 public: |
1446 public: |
1451 |
1447 |
1452 typedef _Base Base; |
1448 typedef BAS Base; |
1453 |
1449 |
1454 /// \brief Erase all nodes and arcs from the digraph. |
1450 /// \brief Erase all nodes and arcs from the digraph. |
1455 /// |
1451 /// |
1456 /// Erase all nodes and arcs from the digraph. |
1452 /// Erase all nodes and arcs from the digraph. |
1457 /// |
1453 /// |
1472 /// |
1468 /// |
1473 /// This class provides beside the core undirected graph features |
1469 /// This class provides beside the core undirected graph features |
1474 /// core clear functions for the undirected graph structure. The |
1470 /// core clear functions for the undirected graph structure. The |
1475 /// main difference between the base and this interface is that |
1471 /// main difference between the base and this interface is that |
1476 /// the graph alterations should handled already on this level. |
1472 /// the graph alterations should handled already on this level. |
1477 template <typename _Base = BaseGraphComponent> |
1473 template <typename BAS = BaseGraphComponent> |
1478 class ClearableGraphComponent : public ClearableDigraphComponent<_Base> { |
1474 class ClearableGraphComponent : public ClearableDigraphComponent<BAS> { |
1479 public: |
1475 public: |
1480 |
1476 |
1481 typedef _Base Base; |
1477 typedef BAS Base; |
1482 |
1478 |
1483 template <typename _Graph> |
1479 template <typename _Graph> |
1484 struct Constraints { |
1480 struct Constraints { |
1485 void constraints() { |
1481 void constraints() { |
1486 checkConcept<ClearableGraphComponent<Base>, _Graph>(); |
1482 checkConcept<ClearableGraphComponent<Base>, _Graph>(); |