Changeset 2286:1ef281b2b10e in lemon0.x
 Timestamp:
 10/31/06 15:41:12 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@3051
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/graph_utils.h
r2235 r2286 84 84 typedef Graph:: UEdgeIt UEdgeIt; \ 85 85 typedef Graph:: IncEdgeIt IncEdgeIt; 86 // typedef Graph::template UEdgeMap<bool> BoolUEdgeMap;87 // typedef Graph::template UEdgeMap<int> IntUEdgeMap;88 // typedef Graph::template UEdgeMap<double> DoubleUEdgeMap;89 86 90 87 ///\brief Creates convenience typedefs for the bipartite undirected graph … … 104 101 #define BPUGRAPH_TYPEDEFS(Graph) \ 105 102 UGRAPH_TYPEDEFS(Graph) \ 103 typedef Graph::ANode ANode; \ 104 typedef Graph::BNode BNode; \ 106 105 typedef Graph::ANodeIt ANodeIt; \ 107 106 typedef Graph::BNodeIt BNodeIt; … … 380 379 ///\sa ConEdgeIt 381 380 template <typename Graph> 382 inline typename Graph::Edge findEdge(const Graph &g, 383 typename Graph::Node u, 384 typename Graph::Node v, 385 typename Graph::Edge prev = INVALID) { 381 inline typename Graph::Edge 382 findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, 383 typename Graph::Edge prev = INVALID) { 386 384 return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, prev); 387 385 } … … 507 505 508 506 template <typename Graph> 509 inline typename Graph::UEdge findUEdge(const Graph &g, 510 typename Graph::Node u, 511 typename Graph::Node v, 512 typename Graph::UEdge p = INVALID) { 507 inline typename Graph::UEdge 508 findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, 509 typename Graph::UEdge p = INVALID) { 513 510 return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, p); 514 511 } … … 589 586 } 590 587 588 namespace _graph_utils_bits { 589 590 template <typename Graph, typename Item, typename RefMap> 591 class MapCopyBase { 592 public: 593 virtual void copy(const Graph& source, const RefMap& refMap) = 0; 594 595 virtual ~MapCopyBase() {} 596 }; 597 598 template <typename Graph, typename Item, typename RefMap, 599 typename TargetMap, typename SourceMap> 600 class MapCopy : public MapCopyBase<Graph, Item, RefMap> { 601 public: 602 603 MapCopy(TargetMap& tmap, const SourceMap& map) 604 : _tmap(tmap), _map(map) {} 605 606 virtual void copy(const Graph& graph, const RefMap& refMap) { 607 typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt; 608 for (ItemIt it(graph); it != INVALID; ++it) { 609 _tmap.set(refMap[it], _map[it]); 610 } 611 } 612 613 private: 614 TargetMap& _tmap; 615 const SourceMap& _map; 616 }; 617 618 template <typename Graph, typename Item, typename RefMap, typename Ref> 619 class RefCopy : public MapCopyBase<Graph, Item, RefMap> { 620 public: 621 622 RefCopy(Ref& map) : _map(map) {} 623 624 virtual void copy(const Graph& graph, const RefMap& refMap) { 625 typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt; 626 for (ItemIt it(graph); it != INVALID; ++it) { 627 _map.set(it, refMap[it]); 628 } 629 } 630 631 private: 632 Ref& _map; 633 }; 634 635 template <typename Graph, typename Item, typename RefMap, 636 typename CrossRef> 637 class CrossRefCopy : public MapCopyBase<Graph, Item, RefMap> { 638 public: 639 640 CrossRefCopy(CrossRef& cmap) : _cmap(cmap) {} 641 642 virtual void copy(const Graph& graph, const RefMap& refMap) { 643 typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt; 644 for (ItemIt it(graph); it != INVALID; ++it) { 645 _cmap.set(refMap[it], it); 646 } 647 } 648 649 private: 650 CrossRef& _cmap; 651 }; 652 653 } 654 591 655 /// \brief Class to copy a graph. 592 656 /// … … 595 659 template <typename Target, typename Source> 596 660 class GraphCopy { 597 public: 661 private: 662 598 663 typedef typename Source::Node Node; 599 664 typedef typename Source::NodeIt NodeIt; … … 601 666 typedef typename Source::EdgeIt EdgeIt; 602 667 603 typedef typename Source::template NodeMap<typename Target::Node>NodeRefMap; 604 typedef typename Source::template EdgeMap<typename Target::Edge>EdgeRefMap; 668 typedef typename Target::Node TNode; 669 typedef typename Target::Edge TEdge; 670 671 typedef typename Source::template NodeMap<TNode> NodeRefMap; 672 typedef typename Source::template EdgeMap<TEdge> EdgeRefMap; 673 674 675 public: 676 605 677 606 678 /// \brief Constructor for the GraphCopy. 607 679 /// 608 680 /// It copies the content of the \c _source graph into the 609 /// \c _target graph. It creates also two references, one beetween 610 /// the two nodeset and one beetween the two edgesets. 681 /// \c _target graph. 611 682 GraphCopy(Target& _target, const Source& _source) 612 : source(_source), target(_target), 613 nodeRefMap(_source), edgeRefMap(_source) { 614 for (NodeIt it(source); it != INVALID; ++it) { 615 nodeRefMap[it] = target.addNode(); 616 } 617 for (EdgeIt it(source); it != INVALID; ++it) { 618 edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 619 nodeRefMap[source.target(it)]); 620 } 683 : source(_source), target(_target) {} 684 685 /// \brief Destructor of the GraphCopy 686 /// 687 /// Destructor of the GraphCopy 688 ~GraphCopy() { 689 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { 690 delete nodeMapCopies[i]; 691 } 692 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { 693 delete edgeMapCopies[i]; 694 } 695 621 696 } 622 697 … … 625 700 /// Copies the node references into the given map. 626 701 template <typename NodeRef> 627 const GraphCopy& nodeRef(NodeRef& map) const { 628 for (NodeIt it(source); it != INVALID; ++it) { 629 map.set(it, nodeRefMap[it]); 630 } 702 GraphCopy& nodeRef(NodeRef& map) { 703 nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node, 704 NodeRefMap, NodeRef>(map)); 631 705 return *this; 632 706 } … … 635 709 /// 636 710 /// Reverse and copies the node references into the given map. 637 template <typename NodeRef> 638 const GraphCopy& nodeCrossRef(NodeRef& map) const { 639 for (NodeIt it(source); it != INVALID; ++it) { 640 map.set(nodeRefMap[it], it); 641 } 642 return *this; 643 } 644 645 /// \brief Copies the edge references into the given map. 646 /// 647 /// Copies the edge references into the given map. 648 template <typename EdgeRef> 649 const GraphCopy& edgeRef(EdgeRef& map) const { 650 for (EdgeIt it(source); it != INVALID; ++it) { 651 map.set(it, edgeRefMap[it]); 652 } 653 return *this; 654 } 655 656 /// \brief Reverse and copies the edge references into the given map. 657 /// 658 /// Reverse and copies the edge references into the given map. 659 template <typename EdgeRef> 660 const GraphCopy& edgeCrossRef(EdgeRef& map) const { 661 for (EdgeIt it(source); it != INVALID; ++it) { 662 map.set(edgeRefMap[it], it); 663 } 711 template <typename NodeCrossRef> 712 GraphCopy& nodeCrossRef(NodeCrossRef& map) { 713 nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node, 714 NodeRefMap, NodeCrossRef>(map)); 664 715 return *this; 665 716 } … … 672 723 /// type. 673 724 template <typename TargetMap, typename SourceMap> 674 const GraphCopy& nodeMap(TargetMap& tMap, const SourceMap& sMap) const { 675 copyMap(tMap, sMap, NodeIt(source), nodeRefMap); 725 GraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) { 726 nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node, 727 NodeRefMap, TargetMap, SourceMap>(tmap, map)); 728 return *this; 729 } 730 731 /// \brief Copies the edge references into the given map. 732 /// 733 /// Copies the edge references into the given map. 734 template <typename EdgeRef> 735 GraphCopy& edgeRef(EdgeRef& map) { 736 edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge, 737 EdgeRefMap, EdgeRef>(map)); 738 return *this; 739 } 740 741 /// \brief Reverse and copies the edge references into the given map. 742 /// 743 /// Reverse and copies the edge references into the given map. 744 template <typename EdgeCrossRef> 745 GraphCopy& edgeCrossRef(EdgeCrossRef& map) { 746 edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge, 747 EdgeRefMap, EdgeCrossRef>(map)); 676 748 return *this; 677 749 } … … 684 756 /// type. 685 757 template <typename TargetMap, typename SourceMap> 686 const GraphCopy& edgeMap(TargetMap& tMap, const SourceMap& sMap) const { 687 copyMap(tMap, sMap, EdgeIt(source), edgeRefMap); 758 GraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) { 759 edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge, 760 EdgeRefMap, TargetMap, SourceMap>(tmap, map)); 688 761 return *this; 689 762 } 690 763 691 /// \brief Gives back the stored node references. 692 /// 693 /// Gives back the stored node references. 694 const NodeRefMap& nodeRef() const { 695 return nodeRefMap; 696 } 697 698 /// \brief Gives back the stored edge references. 699 /// 700 /// Gives back the stored edge references. 701 const EdgeRefMap& edgeRef() const { 702 return edgeRefMap; 703 } 704 705 void run() const {} 764 /// \brief Executes the copies. 765 /// 766 /// Executes the copies. 767 void run() { 768 NodeRefMap nodeRefMap(source); 769 for (NodeIt it(source); it != INVALID; ++it) { 770 nodeRefMap[it] = target.addNode(); 771 } 772 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { 773 nodeMapCopies[i]>copy(source, nodeRefMap); 774 } 775 EdgeRefMap edgeRefMap(source); 776 for (EdgeIt it(source); it != INVALID; ++it) { 777 edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 778 nodeRefMap[source.target(it)]); 779 } 780 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { 781 edgeMapCopies[i]>copy(source, edgeRefMap); 782 } 783 } 706 784 707 785 private: … … 710 788 Target& target; 711 789 712 NodeRefMap nodeRefMap; 713 EdgeRefMap edgeRefMap; 790 std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* > 791 nodeMapCopies; 792 793 std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* > 794 edgeMapCopies; 795 714 796 }; 715 797 … … 720 802 /// 721 803 ///\code 722 /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr) ;804 /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run(); 723 805 ///\endcode 724 806 /// … … 738 820 template <typename Target, typename Source> 739 821 class UGraphCopy { 740 public: 822 private: 823 741 824 typedef typename Source::Node Node; 742 825 typedef typename Source::NodeIt NodeIt; … … 746 829 typedef typename Source::UEdgeIt UEdgeIt; 747 830 748 typedef typename Source:: 749 template NodeMap<typename Target::Node> NodeRefMap; 750 751 typedef typename Source:: 752 template UEdgeMap<typename Target::UEdge> UEdgeRefMap; 753 754 private: 831 typedef typename Target::Node TNode; 832 typedef typename Target::Edge TEdge; 833 typedef typename Target::UEdge TUEdge; 834 835 typedef typename Source::template NodeMap<TNode> NodeRefMap; 836 typedef typename Source::template UEdgeMap<TUEdge> UEdgeRefMap; 755 837 756 838 struct EdgeRefMap { 757 EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {} 839 EdgeRefMap(const Target& _target, const Source& _source, 840 const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref) 841 : target(_target), source(_source), 842 uedge_ref(_uedge_ref), node_ref(_node_ref) {} 843 758 844 typedef typename Source::Edge Key; 759 845 typedef typename Target::Edge Value; 760 846 761 Value operator[](const Key& key) { 762 return gc.target.direct(gc.uEdgeRef[key], 763 gc.target.direction(key)); 847 Value operator[](const Key& key) const { 848 bool forward = (source.direction(key) == 849 (node_ref[source.source((UEdge)key)] == 850 target.source(uedge_ref[(UEdge)key]))); 851 return target.direct(uedge_ref[key], forward); 764 852 } 765 853 766 UGraphCopy& gc; 854 const Target& target; 855 const Source& source; 856 const UEdgeRefMap& uedge_ref; 857 const NodeRefMap& node_ref; 767 858 }; 768 769 public: 770 771 /// \brief Constructor for the UGraphCopy. 859 860 861 public: 862 863 864 /// \brief Constructor for the GraphCopy. 772 865 /// 773 866 /// It copies the content of the \c _source graph into the 774 /// \c _target graph. It creates also two references, one beetween 775 /// the two nodeset and one beetween the two edgesets. 867 /// \c _target graph. 776 868 UGraphCopy(Target& _target, const Source& _source) 777 : source(_source), target(_target), 778 nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) { 779 for (NodeIt it(source); it != INVALID; ++it) { 780 nodeRefMap[it] = target.addNode(); 781 } 782 for (UEdgeIt it(source); it != INVALID; ++it) { 783 uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 784 nodeRefMap[source.target(it)]); 785 } 869 : source(_source), target(_target) {} 870 871 /// \brief Destructor of the GraphCopy 872 /// 873 /// Destructor of the GraphCopy 874 ~UGraphCopy() { 875 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { 876 delete nodeMapCopies[i]; 877 } 878 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { 879 delete edgeMapCopies[i]; 880 } 881 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { 882 delete uEdgeMapCopies[i]; 883 } 884 786 885 } 787 886 … … 790 889 /// Copies the node references into the given map. 791 890 template <typename NodeRef> 792 const UGraphCopy& nodeRef(NodeRef& map) const { 793 for (NodeIt it(source); it != INVALID; ++it) { 794 map.set(it, nodeRefMap[it]); 795 } 891 UGraphCopy& nodeRef(NodeRef& map) { 892 nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node, 893 NodeRefMap, NodeRef>(map)); 796 894 return *this; 797 895 } … … 800 898 /// 801 899 /// Reverse and copies the node references into the given map. 802 template <typename NodeRef> 803 const UGraphCopy& nodeCrossRef(NodeRef& map) const { 804 for (NodeIt it(source); it != INVALID; ++it) { 805 map.set(nodeRefMap[it], it); 806 } 807 return *this; 808 } 809 810 /// \brief Copies the edge references into the given map. 811 /// 812 /// Copies the edge references into the given map. 813 template <typename EdgeRef> 814 const UGraphCopy& edgeRef(EdgeRef& map) const { 815 for (EdgeIt it(source); it != INVALID; ++it) { 816 map.set(edgeRefMap[it], it); 817 } 818 return *this; 819 } 820 821 /// \brief Reverse and copies the undirected edge references into the 822 /// given map. 823 /// 824 /// Reverse and copies the undirected edge references into the given map. 825 template <typename EdgeRef> 826 const UGraphCopy& edgeCrossRef(EdgeRef& map) const { 827 for (EdgeIt it(source); it != INVALID; ++it) { 828 map.set(it, edgeRefMap[it]); 829 } 830 return *this; 831 } 832 833 /// \brief Copies the undirected edge references into the given map. 834 /// 835 /// Copies the undirected edge references into the given map. 836 template <typename EdgeRef> 837 const UGraphCopy& uEdgeRef(EdgeRef& map) const { 838 for (UEdgeIt it(source); it != INVALID; ++it) { 839 map.set(it, uEdgeRefMap[it]); 840 } 841 return *this; 842 } 843 844 /// \brief Reverse and copies the undirected edge references into the 845 /// given map. 846 /// 847 /// Reverse and copies the undirected edge references into the given map. 848 template <typename EdgeRef> 849 const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const { 850 for (UEdgeIt it(source); it != INVALID; ++it) { 851 map.set(uEdgeRefMap[it], it); 852 } 900 template <typename NodeCrossRef> 901 UGraphCopy& nodeCrossRef(NodeCrossRef& map) { 902 nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node, 903 NodeRefMap, NodeCrossRef>(map)); 853 904 return *this; 854 905 } … … 861 912 /// type. 862 913 template <typename TargetMap, typename SourceMap> 863 const UGraphCopy& nodeMap(TargetMap& tMap, 864 const SourceMap& sMap) const { 865 copyMap(tMap, sMap, NodeIt(source), nodeRefMap); 914 UGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) { 915 nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node, 916 NodeRefMap, TargetMap, SourceMap>(tmap, map)); 917 return *this; 918 } 919 920 /// \brief Copies the edge references into the given map. 921 /// 922 /// Copies the edge references into the given map. 923 template <typename EdgeRef> 924 UGraphCopy& edgeRef(EdgeRef& map) { 925 edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge, 926 EdgeRefMap, EdgeRef>(map)); 927 return *this; 928 } 929 930 /// \brief Reverse and copies the edge references into the given map. 931 /// 932 /// Reverse and copies the edge references into the given map. 933 template <typename EdgeCrossRef> 934 UGraphCopy& edgeCrossRef(EdgeCrossRef& map) { 935 edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge, 936 EdgeRefMap, EdgeCrossRef>(map)); 866 937 return *this; 867 938 } … … 874 945 /// type. 875 946 template <typename TargetMap, typename SourceMap> 876 const UGraphCopy& edgeMap(TargetMap& tMap,877 const SourceMap& sMap) const { 878 copyMap(tMap, sMap, EdgeIt(source), edgeRefMap);947 UGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) { 948 edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge, 949 EdgeRefMap, TargetMap, SourceMap>(tmap, map)); 879 950 return *this; 880 951 } 881 952 953 /// \brief Copies the uEdge references into the given map. 954 /// 955 /// Copies the uEdge references into the given map. 956 template <typename UEdgeRef> 957 UGraphCopy& uEdgeRef(UEdgeRef& map) { 958 uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, UEdge, 959 UEdgeRefMap, UEdgeRef>(map)); 960 return *this; 961 } 962 963 /// \brief Reverse and copies the uEdge references into the given map. 964 /// 965 /// Reverse and copies the uEdge references into the given map. 966 template <typename UEdgeCrossRef> 967 UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) { 968 uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, 969 UEdge, UEdgeRefMap, UEdgeCrossRef>(map)); 970 return *this; 971 } 972 882 973 /// \brief Make copy of the given map. 883 974 /// 884 975 /// Makes copy of the given map for the newly created graph. 885 /// The new map's key type is the target graph's edge type,886 /// and the copied map's key type is the source graph's edge976 /// The new map's key type is the target graph's uEdge type, 977 /// and the copied map's key type is the source graph's uEdge 887 978 /// type. 888 979 template <typename TargetMap, typename SourceMap> 889 const UGraphCopy& uEdgeMap(TargetMap& tMap,890 const SourceMap& sMap) const { 891 copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap);980 UGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) { 981 uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, UEdge, 982 UEdgeRefMap, TargetMap, SourceMap>(tmap, map)); 892 983 return *this; 893 984 } 894 985 895 /// \brief Gives back the stored node references. 896 /// 897 /// Gives back the stored node references. 898 const NodeRefMap& nodeRef() const { 899 return nodeRefMap; 900 } 901 902 /// \brief Gives back the stored edge references. 903 /// 904 /// Gives back the stored edge references. 905 const EdgeRefMap& edgeRef() const { 906 return edgeRefMap; 907 } 908 909 /// \brief Gives back the stored uedge references. 910 /// 911 /// Gives back the stored uedge references. 912 const UEdgeRefMap& uEdgeRef() const { 913 return uEdgeRefMap; 914 } 915 916 void run() const {} 986 /// \brief Executes the copies. 987 /// 988 /// Executes the copies. 989 void run() { 990 NodeRefMap nodeRefMap(source); 991 for (NodeIt it(source); it != INVALID; ++it) { 992 nodeRefMap[it] = target.addNode(); 993 } 994 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { 995 nodeMapCopies[i]>copy(source, nodeRefMap); 996 } 997 UEdgeRefMap uEdgeRefMap(source); 998 EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); 999 for (UEdgeIt it(source); it != INVALID; ++it) { 1000 uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 1001 nodeRefMap[source.target(it)]); 1002 } 1003 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { 1004 uEdgeMapCopies[i]>copy(source, uEdgeRefMap); 1005 } 1006 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { 1007 edgeMapCopies[i]>copy(source, edgeRefMap); 1008 } 1009 } 917 1010 918 1011 private: … … 921 1014 Target& target; 922 1015 923 NodeRefMap nodeRefMap; 924 EdgeRefMap edgeRefMap; 925 UEdgeRefMap uEdgeRefMap; 1016 std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* > 1017 nodeMapCopies; 1018 1019 std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* > 1020 edgeMapCopies; 1021 1022 std::vector<_graph_utils_bits::MapCopyBase<Source, UEdge, UEdgeRefMap>* > 1023 uEdgeMapCopies; 1024 926 1025 }; 927 1026 … … 932 1031 /// 933 1032 ///\code 934 /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr) ;1033 /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run(); 935 1034 ///\endcode 936 1035 /// … … 972 1071 /// 973 1072 /// Constructor for creating id map. 974 IdMap(const Graph& _graph) : graph(&_graph) {}1073 explicit IdMap(const Graph& _graph) : graph(&_graph) {} 975 1074 976 1075 /// \brief Gives back the \e id of the item. … … 995 1094 /// 996 1095 /// Constructor for creating an idtoitem map. 997 InverseMap(const Graph& _graph) : graph(&_graph) {}1096 explicit InverseMap(const Graph& _graph) : graph(&_graph) {} 998 1097 999 1098 /// \brief Constructor. 1000 1099 /// 1001 1100 /// Constructor for creating an idtoitem map. 1002 InverseMap(const IdMap& idMap) : graph(idMap.graph) {}1101 explicit InverseMap(const IdMap& idMap) : graph(idMap.graph) {} 1003 1102 1004 1103 /// \brief Gives back the given item from its id. … … 1067 1166 /// Construct a new InvertableMap for the graph. 1068 1167 /// 1069 InvertableMap(const Graph& graph) : Map(graph) {}1168 explicit InvertableMap(const Graph& graph) : Map(graph) {} 1070 1169 1071 1170 /// \brief Forward iterator for values. … … 1193 1292 /// 1194 1293 /// Constructor of the InverseMap. 1195 InverseMap(const InvertableMap& _inverted) : inverted(_inverted) {} 1294 explicit InverseMap(const InvertableMap& _inverted) 1295 : inverted(_inverted) {} 1196 1296 1197 1297 /// The value type of the InverseMap. … … 1265 1365 /// 1266 1366 /// Constructor for descriptor map. 1267 DescriptorMap(const Graph& _graph) : Map(_graph) {1367 explicit DescriptorMap(const Graph& _graph) : Map(_graph) { 1268 1368 Item it; 1269 1369 const typename Map::Notifier* notifier = Map::getNotifier(); … … 1273 1373 } 1274 1374 } 1375 1275 1376 1276 1377 protected: … … 1387 1488 /// 1388 1489 /// Constructor of the InverseMap. 1389 InverseMap(const DescriptorMap& _inverted)1490 explicit InverseMap(const DescriptorMap& _inverted) 1390 1491 : inverted(_inverted) {} 1391 1492 … … 1438 1539 /// Constructor 1439 1540 /// \param _graph The graph that the map belongs to. 1440 SourceMap(const Graph& _graph) : graph(_graph) {}1541 explicit SourceMap(const Graph& _graph) : graph(_graph) {} 1441 1542 1442 1543 /// \brief The subscript operator. … … 1477 1578 /// Constructor 1478 1579 /// \param _graph The graph that the map belongs to. 1479 TargetMap(const Graph& _graph) : graph(_graph) {}1580 explicit TargetMap(const Graph& _graph) : graph(_graph) {} 1480 1581 1481 1582 /// \brief The subscript operator. … … 1516 1617 /// Constructor 1517 1618 /// \param _graph The graph that the map belongs to. 1518 ForwardMap(const Graph& _graph) : graph(_graph) {}1619 explicit ForwardMap(const Graph& _graph) : graph(_graph) {} 1519 1620 1520 1621 /// \brief The subscript operator. … … 1555 1656 /// Constructor 1556 1657 /// \param _graph The graph that the map belongs to. 1557 BackwardMap(const Graph& _graph) : graph(_graph) {}1658 explicit BackwardMap(const Graph& _graph) : graph(_graph) {} 1558 1659 1559 1660 /// \brief The subscript operator. … … 1593 1694 /// 1594 1695 /// Contructor of the map 1595 PotentialDifferenceMap(const Graph& _graph, const NodeMap& _potential) 1696 explicit PotentialDifferenceMap(const Graph& _graph, 1697 const NodeMap& _potential) 1596 1698 : graph(_graph), potential(_potential) {} 1597 1699 … … 1677 1779 /// 1678 1780 /// Constructor for creating indegree map. 1679 InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {1781 explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) { 1680 1782 Parent::attach(graph.getNotifier(typename _Graph::Edge())); 1681 1783 … … 1789 1891 /// 1790 1892 /// Constructor for creating outdegree map. 1791 OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {1893 explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) { 1792 1894 Parent::attach(graph.getNotifier(typename _Graph::Edge())); 1793 1895
Note: See TracChangeset
for help on using the changeset viewer.