# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1248726105 -7200
# Node ID f85e505e7eba018b33680b807388a44cb51fb114
# Parent a4d00df8852e1f58f3d8b4339329337dae765162
Small doc improvements (#304)
diff --git a/lemon/bfs.h b/lemon/bfs.h
|
a
|
b
|
|
| 47 | 47 | /// |
| 48 | 48 | ///The type of the map that stores the predecessor |
| 49 | 49 | ///arcs of the shortest paths. |
| 50 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 50 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 51 | 51 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 52 | 52 | ///Instantiates a \c PredMap. |
| 53 | 53 | |
| … |
… |
|
| 62 | 62 | ///The type of the map that indicates which nodes are processed. |
| 63 | 63 | |
| 64 | 64 | ///The type of the map that indicates which nodes are processed. |
| 65 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 65 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 66 | 66 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 67 | 67 | ///Instantiates a \c ProcessedMap. |
| 68 | 68 | |
| … |
… |
|
| 81 | 81 | ///The type of the map that indicates which nodes are reached. |
| 82 | 82 | |
| 83 | 83 | ///The type of the map that indicates which nodes are reached. |
| 84 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 84 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 85 | 85 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 86 | 86 | ///Instantiates a \c ReachedMap. |
| 87 | 87 | |
| … |
… |
|
| 96 | 96 | ///The type of the map that stores the distances of the nodes. |
| 97 | 97 | |
| 98 | 98 | ///The type of the map that stores the distances of the nodes. |
| 99 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 99 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 100 | 100 | typedef typename Digraph::template NodeMap<int> DistMap; |
| 101 | 101 | ///Instantiates a \c DistMap. |
| 102 | 102 | |
| … |
… |
|
| 225 | 225 | /// |
| 226 | 226 | ///\ref named-templ-param "Named parameter" for setting |
| 227 | 227 | ///\c PredMap type. |
| 228 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 228 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 229 | 229 | template <class T> |
| 230 | 230 | struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > { |
| 231 | 231 | typedef Bfs< Digraph, SetPredMapTraits<T> > Create; |
| … |
… |
|
| 245 | 245 | /// |
| 246 | 246 | ///\ref named-templ-param "Named parameter" for setting |
| 247 | 247 | ///\c DistMap type. |
| 248 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 248 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 249 | 249 | template <class T> |
| 250 | 250 | struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > { |
| 251 | 251 | typedef Bfs< Digraph, SetDistMapTraits<T> > Create; |
| … |
… |
|
| 265 | 265 | /// |
| 266 | 266 | ///\ref named-templ-param "Named parameter" for setting |
| 267 | 267 | ///\c ReachedMap type. |
| 268 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 268 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 269 | 269 | template <class T> |
| 270 | 270 | struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > { |
| 271 | 271 | typedef Bfs< Digraph, SetReachedMapTraits<T> > Create; |
| … |
… |
|
| 285 | 285 | /// |
| 286 | 286 | ///\ref named-templ-param "Named parameter" for setting |
| 287 | 287 | ///\c ProcessedMap type. |
| 288 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 288 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 289 | 289 | template <class T> |
| 290 | 290 | struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > { |
| 291 | 291 | typedef Bfs< Digraph, SetProcessedMapTraits<T> > Create; |
| … |
… |
|
| 737 | 737 | |
| 738 | 738 | ///@{ |
| 739 | 739 | |
| 740 | | ///The shortest path to a node. |
| | 740 | ///The shortest path to the given node. |
| 741 | 741 | |
| 742 | | ///Returns the shortest path to a node. |
| | 742 | ///Returns the shortest path to the given node from the root(s). |
| 743 | 743 | /// |
| 744 | 744 | ///\warning \c t should be reached from the root(s). |
| 745 | 745 | /// |
| … |
… |
|
| 747 | 747 | ///must be called before using this function. |
| 748 | 748 | Path path(Node t) const { return Path(*G, *_pred, t); } |
| 749 | 749 | |
| 750 | | ///The distance of a node from the root(s). |
| | 750 | ///The distance of the given node from the root(s). |
| 751 | 751 | |
| 752 | | ///Returns the distance of a node from the root(s). |
| | 752 | ///Returns the distance of the given node from the root(s). |
| 753 | 753 | /// |
| 754 | 754 | ///\warning If node \c v is not reached from the root(s), then |
| 755 | 755 | ///the return value of this function is undefined. |
| … |
… |
|
| 758 | 758 | ///must be called before using this function. |
| 759 | 759 | int dist(Node v) const { return (*_dist)[v]; } |
| 760 | 760 | |
| 761 | | ///Returns the 'previous arc' of the shortest path tree for a node. |
| 762 | | |
| | 761 | ///\brief Returns the 'previous arc' of the shortest path tree for |
| | 762 | ///the given node. |
| | 763 | /// |
| 763 | 764 | ///This function returns the 'previous arc' of the shortest path |
| 764 | 765 | ///tree for the node \c v, i.e. it returns the last arc of a |
| 765 | 766 | ///shortest path from a root to \c v. It is \c INVALID if \c v |
| 766 | 767 | ///is not reached from the root(s) or if \c v is a root. |
| 767 | 768 | /// |
| 768 | 769 | ///The shortest path tree used here is equal to the shortest path |
| 769 | | ///tree used in \ref predNode(). |
| | 770 | ///tree used in \ref predNode() and \ref predMap(). |
| 770 | 771 | /// |
| 771 | 772 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 772 | 773 | ///must be called before using this function. |
| 773 | 774 | Arc predArc(Node v) const { return (*_pred)[v];} |
| 774 | 775 | |
| 775 | | ///Returns the 'previous node' of the shortest path tree for a node. |
| 776 | | |
| | 776 | ///\brief Returns the 'previous node' of the shortest path tree for |
| | 777 | ///the given node. |
| | 778 | /// |
| 777 | 779 | ///This function returns the 'previous node' of the shortest path |
| 778 | 780 | ///tree for the node \c v, i.e. it returns the last but one node |
| 779 | | ///from a shortest path from a root to \c v. It is \c INVALID |
| | 781 | ///of a shortest path from a root to \c v. It is \c INVALID |
| 780 | 782 | ///if \c v is not reached from the root(s) or if \c v is a root. |
| 781 | 783 | /// |
| 782 | 784 | ///The shortest path tree used here is equal to the shortest path |
| 783 | | ///tree used in \ref predArc(). |
| | 785 | ///tree used in \ref predArc() and \ref predMap(). |
| 784 | 786 | /// |
| 785 | 787 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 786 | 788 | ///must be called before using this function. |
| … |
… |
|
| 801 | 803 | ///predecessor arcs. |
| 802 | 804 | /// |
| 803 | 805 | ///Returns a const reference to the node map that stores the predecessor |
| 804 | | ///arcs, which form the shortest path tree. |
| | 806 | ///arcs, which form the shortest path tree (forest). |
| 805 | 807 | /// |
| 806 | 808 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 807 | 809 | ///must be called before using this function. |
| 808 | 810 | const PredMap &predMap() const { return *_pred;} |
| 809 | 811 | |
| 810 | | ///Checks if a node is reached from the root(s). |
| | 812 | ///Checks if the given node is reached from the root(s). |
| 811 | 813 | |
| 812 | 814 | ///Returns \c true if \c v is reached from the root(s). |
| 813 | 815 | /// |
| … |
… |
|
| 833 | 835 | /// |
| 834 | 836 | ///The type of the map that stores the predecessor |
| 835 | 837 | ///arcs of the shortest paths. |
| 836 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 838 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 837 | 839 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 838 | 840 | ///Instantiates a PredMap. |
| 839 | 841 | |
| … |
… |
|
| 848 | 850 | ///The type of the map that indicates which nodes are processed. |
| 849 | 851 | |
| 850 | 852 | ///The type of the map that indicates which nodes are processed. |
| 851 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 853 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 852 | 854 | ///By default it is a NullMap. |
| 853 | 855 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 854 | 856 | ///Instantiates a ProcessedMap. |
| … |
… |
|
| 868 | 870 | ///The type of the map that indicates which nodes are reached. |
| 869 | 871 | |
| 870 | 872 | ///The type of the map that indicates which nodes are reached. |
| 871 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 873 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 872 | 874 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 873 | 875 | ///Instantiates a ReachedMap. |
| 874 | 876 | |
| … |
… |
|
| 883 | 885 | ///The type of the map that stores the distances of the nodes. |
| 884 | 886 | |
| 885 | 887 | ///The type of the map that stores the distances of the nodes. |
| 886 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 888 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 887 | 889 | typedef typename Digraph::template NodeMap<int> DistMap; |
| 888 | 890 | ///Instantiates a DistMap. |
| 889 | 891 | |
| … |
… |
|
| 898 | 900 | ///The type of the shortest paths. |
| 899 | 901 | |
| 900 | 902 | ///The type of the shortest paths. |
| 901 | | ///It must meet the \ref concepts::Path "Path" concept. |
| | 903 | ///It must conform to the \ref concepts::Path "Path" concept. |
| 902 | 904 | typedef lemon::Path<Digraph> Path; |
| 903 | 905 | }; |
| 904 | 906 | |
| 905 | 907 | /// Default traits class used by BfsWizard |
| 906 | 908 | |
| 907 | | /// To make it easier to use Bfs algorithm |
| 908 | | /// we have created a wizard class. |
| 909 | | /// This \ref BfsWizard class needs default traits, |
| 910 | | /// as well as the \ref Bfs class. |
| 911 | | /// The \ref BfsWizardBase is a class to be the default traits of the |
| 912 | | /// \ref BfsWizard class. |
| | 909 | /// Default traits class used by BfsWizard. |
| | 910 | /// \tparam GR The type of the digraph. |
| 913 | 911 | template<class GR> |
| 914 | 912 | class BfsWizardBase : public BfsWizardDefaultTraits<GR> |
| 915 | 913 | { |
| … |
… |
|
| 937 | 935 | public: |
| 938 | 936 | /// Constructor. |
| 939 | 937 | |
| 940 | | /// This constructor does not require parameters, therefore it initiates |
| | 938 | /// This constructor does not require parameters, it initiates |
| 941 | 939 | /// all of the attributes to \c 0. |
| 942 | 940 | BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0), |
| 943 | 941 | _dist(0), _path(0), _di(0) {} |
| … |
… |
|
| 967 | 965 | { |
| 968 | 966 | typedef TR Base; |
| 969 | 967 | |
| 970 | | ///The type of the digraph the algorithm runs on. |
| 971 | 968 | typedef typename TR::Digraph Digraph; |
| 972 | 969 | |
| 973 | 970 | typedef typename Digraph::Node Node; |
| … |
… |
|
| 975 | 972 | typedef typename Digraph::Arc Arc; |
| 976 | 973 | typedef typename Digraph::OutArcIt OutArcIt; |
| 977 | 974 | |
| 978 | | ///\brief The type of the map that stores the predecessor |
| 979 | | ///arcs of the shortest paths. |
| 980 | 975 | typedef typename TR::PredMap PredMap; |
| 981 | | ///\brief The type of the map that stores the distances of the nodes. |
| 982 | 976 | typedef typename TR::DistMap DistMap; |
| 983 | | ///\brief The type of the map that indicates which nodes are reached. |
| 984 | 977 | typedef typename TR::ReachedMap ReachedMap; |
| 985 | | ///\brief The type of the map that indicates which nodes are processed. |
| 986 | 978 | typedef typename TR::ProcessedMap ProcessedMap; |
| 987 | | ///The type of the shortest paths |
| 988 | 979 | typedef typename TR::Path Path; |
| 989 | 980 | |
| 990 | 981 | public: |
| … |
… |
|
| 1067 | 1058 | static PredMap *createPredMap(const Digraph &) { return 0; }; |
| 1068 | 1059 | SetPredMapBase(const TR &b) : TR(b) {} |
| 1069 | 1060 | }; |
| 1070 | | ///\brief \ref named-func-param "Named parameter" |
| 1071 | | ///for setting PredMap object. |
| | 1061 | |
| | 1062 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1063 | ///the predecessor map. |
| 1072 | 1064 | /// |
| 1073 | | ///\ref named-func-param "Named parameter" |
| 1074 | | ///for setting PredMap object. |
| | 1065 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1066 | ///the map that stores the predecessor arcs of the nodes. |
| 1075 | 1067 | template<class T> |
| 1076 | 1068 | BfsWizard<SetPredMapBase<T> > predMap(const T &t) |
| 1077 | 1069 | { |
| … |
… |
|
| 1085 | 1077 | static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
| 1086 | 1078 | SetReachedMapBase(const TR &b) : TR(b) {} |
| 1087 | 1079 | }; |
| 1088 | | ///\brief \ref named-func-param "Named parameter" |
| 1089 | | ///for setting ReachedMap object. |
| | 1080 | |
| | 1081 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1082 | ///the reached map. |
| 1090 | 1083 | /// |
| 1091 | | /// \ref named-func-param "Named parameter" |
| 1092 | | ///for setting ReachedMap object. |
| | 1084 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1085 | ///the map that indicates which nodes are reached. |
| 1093 | 1086 | template<class T> |
| 1094 | 1087 | BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) |
| 1095 | 1088 | { |
| … |
… |
|
| 1103 | 1096 | static DistMap *createDistMap(const Digraph &) { return 0; }; |
| 1104 | 1097 | SetDistMapBase(const TR &b) : TR(b) {} |
| 1105 | 1098 | }; |
| 1106 | | ///\brief \ref named-func-param "Named parameter" |
| 1107 | | ///for setting DistMap object. |
| | 1099 | |
| | 1100 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1101 | ///the distance map. |
| 1108 | 1102 | /// |
| 1109 | | /// \ref named-func-param "Named parameter" |
| 1110 | | ///for setting DistMap object. |
| | 1103 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1104 | ///the map that stores the distances of the nodes calculated |
| | 1105 | ///by the algorithm. |
| 1111 | 1106 | template<class T> |
| 1112 | 1107 | BfsWizard<SetDistMapBase<T> > distMap(const T &t) |
| 1113 | 1108 | { |
| … |
… |
|
| 1121 | 1116 | static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
| 1122 | 1117 | SetProcessedMapBase(const TR &b) : TR(b) {} |
| 1123 | 1118 | }; |
| 1124 | | ///\brief \ref named-func-param "Named parameter" |
| 1125 | | ///for setting ProcessedMap object. |
| | 1119 | |
| | 1120 | ///\brief \ref named-func-param "Named parameter" for setting |
| | 1121 | ///the processed map. |
| 1126 | 1122 | /// |
| 1127 | | /// \ref named-func-param "Named parameter" |
| 1128 | | ///for setting ProcessedMap object. |
| | 1123 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1124 | ///the map that indicates which nodes are processed. |
| 1129 | 1125 | template<class T> |
| 1130 | 1126 | BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
| 1131 | 1127 | { |
| … |
… |
|
| 1264 | 1260 | /// \brief The type of the map that indicates which nodes are reached. |
| 1265 | 1261 | /// |
| 1266 | 1262 | /// The type of the map that indicates which nodes are reached. |
| 1267 | | /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 1263 | /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 1268 | 1264 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 1269 | 1265 | |
| 1270 | 1266 | /// \brief Instantiates a ReachedMap. |
| … |
… |
|
| 1735 | 1731 | |
| 1736 | 1732 | ///@{ |
| 1737 | 1733 | |
| 1738 | | /// \brief Checks if a node is reached from the root(s). |
| | 1734 | /// \brief Checks if the given node is reached from the root(s). |
| 1739 | 1735 | /// |
| 1740 | 1736 | /// Returns \c true if \c v is reached from the root(s). |
| 1741 | 1737 | /// |
diff --git a/lemon/dfs.h b/lemon/dfs.h
|
a
|
b
|
|
| 47 | 47 | /// |
| 48 | 48 | ///The type of the map that stores the predecessor |
| 49 | 49 | ///arcs of the %DFS paths. |
| 50 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 50 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 51 | 51 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 52 | 52 | ///Instantiates a \c PredMap. |
| 53 | 53 | |
| … |
… |
|
| 62 | 62 | ///The type of the map that indicates which nodes are processed. |
| 63 | 63 | |
| 64 | 64 | ///The type of the map that indicates which nodes are processed. |
| 65 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 65 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 66 | 66 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 67 | 67 | ///Instantiates a \c ProcessedMap. |
| 68 | 68 | |
| … |
… |
|
| 81 | 81 | ///The type of the map that indicates which nodes are reached. |
| 82 | 82 | |
| 83 | 83 | ///The type of the map that indicates which nodes are reached. |
| 84 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 84 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 85 | 85 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 86 | 86 | ///Instantiates a \c ReachedMap. |
| 87 | 87 | |
| … |
… |
|
| 96 | 96 | ///The type of the map that stores the distances of the nodes. |
| 97 | 97 | |
| 98 | 98 | ///The type of the map that stores the distances of the nodes. |
| 99 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 99 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 100 | 100 | typedef typename Digraph::template NodeMap<int> DistMap; |
| 101 | 101 | ///Instantiates a \c DistMap. |
| 102 | 102 | |
| … |
… |
|
| 224 | 224 | /// |
| 225 | 225 | ///\ref named-templ-param "Named parameter" for setting |
| 226 | 226 | ///\c PredMap type. |
| 227 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 227 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 228 | 228 | template <class T> |
| 229 | 229 | struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > { |
| 230 | 230 | typedef Dfs<Digraph, SetPredMapTraits<T> > Create; |
| … |
… |
|
| 244 | 244 | /// |
| 245 | 245 | ///\ref named-templ-param "Named parameter" for setting |
| 246 | 246 | ///\c DistMap type. |
| 247 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 247 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 248 | 248 | template <class T> |
| 249 | 249 | struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > { |
| 250 | 250 | typedef Dfs<Digraph, SetDistMapTraits<T> > Create; |
| … |
… |
|
| 264 | 264 | /// |
| 265 | 265 | ///\ref named-templ-param "Named parameter" for setting |
| 266 | 266 | ///\c ReachedMap type. |
| 267 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 267 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 268 | 268 | template <class T> |
| 269 | 269 | struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > { |
| 270 | 270 | typedef Dfs< Digraph, SetReachedMapTraits<T> > Create; |
| … |
… |
|
| 284 | 284 | /// |
| 285 | 285 | ///\ref named-templ-param "Named parameter" for setting |
| 286 | 286 | ///\c ProcessedMap type. |
| 287 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 287 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 288 | 288 | template <class T> |
| 289 | 289 | struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > { |
| 290 | 290 | typedef Dfs< Digraph, SetProcessedMapTraits<T> > Create; |
| … |
… |
|
| 669 | 669 | |
| 670 | 670 | ///@{ |
| 671 | 671 | |
| 672 | | ///The DFS path to a node. |
| | 672 | ///The DFS path to the given node. |
| 673 | 673 | |
| 674 | | ///Returns the DFS path to a node. |
| | 674 | ///Returns the DFS path to the given node from the root(s). |
| 675 | 675 | /// |
| 676 | 676 | ///\warning \c t should be reached from the root(s). |
| 677 | 677 | /// |
| … |
… |
|
| 679 | 679 | ///must be called before using this function. |
| 680 | 680 | Path path(Node t) const { return Path(*G, *_pred, t); } |
| 681 | 681 | |
| 682 | | ///The distance of a node from the root(s). |
| | 682 | ///The distance of the given node from the root(s). |
| 683 | 683 | |
| 684 | | ///Returns the distance of a node from the root(s). |
| | 684 | ///Returns the distance of the given node from the root(s). |
| 685 | 685 | /// |
| 686 | 686 | ///\warning If node \c v is not reached from the root(s), then |
| 687 | 687 | ///the return value of this function is undefined. |
| … |
… |
|
| 690 | 690 | ///must be called before using this function. |
| 691 | 691 | int dist(Node v) const { return (*_dist)[v]; } |
| 692 | 692 | |
| 693 | | ///Returns the 'previous arc' of the %DFS tree for a node. |
| | 693 | ///Returns the 'previous arc' of the %DFS tree for the given node. |
| 694 | 694 | |
| 695 | 695 | ///This function returns the 'previous arc' of the %DFS tree for the |
| 696 | 696 | ///node \c v, i.e. it returns the last arc of a %DFS path from a |
| … |
… |
|
| 698 | 698 | ///root(s) or if \c v is a root. |
| 699 | 699 | /// |
| 700 | 700 | ///The %DFS tree used here is equal to the %DFS tree used in |
| 701 | | ///\ref predNode(). |
| | 701 | ///\ref predNode() and \ref predMap(). |
| 702 | 702 | /// |
| 703 | 703 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 704 | 704 | ///must be called before using this function. |
| 705 | 705 | Arc predArc(Node v) const { return (*_pred)[v];} |
| 706 | 706 | |
| 707 | | ///Returns the 'previous node' of the %DFS tree. |
| | 707 | ///Returns the 'previous node' of the %DFS tree for the given node. |
| 708 | 708 | |
| 709 | 709 | ///This function returns the 'previous node' of the %DFS |
| 710 | 710 | ///tree for the node \c v, i.e. it returns the last but one node |
| 711 | | ///from a %DFS path from a root to \c v. It is \c INVALID |
| | 711 | ///of a %DFS path from a root to \c v. It is \c INVALID |
| 712 | 712 | ///if \c v is not reached from the root(s) or if \c v is a root. |
| 713 | 713 | /// |
| 714 | 714 | ///The %DFS tree used here is equal to the %DFS tree used in |
| 715 | | ///\ref predArc(). |
| | 715 | ///\ref predArc() and \ref predMap(). |
| 716 | 716 | /// |
| 717 | 717 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 718 | 718 | ///must be called before using this function. |
| … |
… |
|
| 733 | 733 | ///predecessor arcs. |
| 734 | 734 | /// |
| 735 | 735 | ///Returns a const reference to the node map that stores the predecessor |
| 736 | | ///arcs, which form the DFS tree. |
| | 736 | ///arcs, which form the DFS tree (forest). |
| 737 | 737 | /// |
| 738 | 738 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 739 | 739 | ///must be called before using this function. |
| 740 | 740 | const PredMap &predMap() const { return *_pred;} |
| 741 | 741 | |
| 742 | | ///Checks if a node is reached from the root(s). |
| | 742 | ///Checks if the given node. node is reached from the root(s). |
| 743 | 743 | |
| 744 | 744 | ///Returns \c true if \c v is reached from the root(s). |
| 745 | 745 | /// |
| … |
… |
|
| 765 | 765 | /// |
| 766 | 766 | ///The type of the map that stores the predecessor |
| 767 | 767 | ///arcs of the %DFS paths. |
| 768 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 768 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 769 | 769 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 770 | 770 | ///Instantiates a PredMap. |
| 771 | 771 | |
| … |
… |
|
| 780 | 780 | ///The type of the map that indicates which nodes are processed. |
| 781 | 781 | |
| 782 | 782 | ///The type of the map that indicates which nodes are processed. |
| 783 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 783 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 784 | 784 | ///By default it is a NullMap. |
| 785 | 785 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 786 | 786 | ///Instantiates a ProcessedMap. |
| … |
… |
|
| 800 | 800 | ///The type of the map that indicates which nodes are reached. |
| 801 | 801 | |
| 802 | 802 | ///The type of the map that indicates which nodes are reached. |
| 803 | | ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 803 | ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 804 | 804 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 805 | 805 | ///Instantiates a ReachedMap. |
| 806 | 806 | |
| … |
… |
|
| 815 | 815 | ///The type of the map that stores the distances of the nodes. |
| 816 | 816 | |
| 817 | 817 | ///The type of the map that stores the distances of the nodes. |
| 818 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 818 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 819 | 819 | typedef typename Digraph::template NodeMap<int> DistMap; |
| 820 | 820 | ///Instantiates a DistMap. |
| 821 | 821 | |
| … |
… |
|
| 830 | 830 | ///The type of the DFS paths. |
| 831 | 831 | |
| 832 | 832 | ///The type of the DFS paths. |
| 833 | | ///It must meet the \ref concepts::Path "Path" concept. |
| | 833 | ///It must conform to the \ref concepts::Path "Path" concept. |
| 834 | 834 | typedef lemon::Path<Digraph> Path; |
| 835 | 835 | }; |
| 836 | 836 | |
| 837 | 837 | /// Default traits class used by DfsWizard |
| 838 | 838 | |
| 839 | | /// To make it easier to use Dfs algorithm |
| 840 | | /// we have created a wizard class. |
| 841 | | /// This \ref DfsWizard class needs default traits, |
| 842 | | /// as well as the \ref Dfs class. |
| 843 | | /// The \ref DfsWizardBase is a class to be the default traits of the |
| 844 | | /// \ref DfsWizard class. |
| | 839 | /// Default traits class used by DfsWizard. |
| | 840 | /// \tparam GR The type of the digraph. |
| 845 | 841 | template<class GR> |
| 846 | 842 | class DfsWizardBase : public DfsWizardDefaultTraits<GR> |
| 847 | 843 | { |
| … |
… |
|
| 869 | 865 | public: |
| 870 | 866 | /// Constructor. |
| 871 | 867 | |
| 872 | | /// This constructor does not require parameters, therefore it initiates |
| | 868 | /// This constructor does not require parameters, it initiates |
| 873 | 869 | /// all of the attributes to \c 0. |
| 874 | 870 | DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0), |
| 875 | 871 | _dist(0), _path(0), _di(0) {} |
| … |
… |
|
| 899 | 895 | { |
| 900 | 896 | typedef TR Base; |
| 901 | 897 | |
| 902 | | ///The type of the digraph the algorithm runs on. |
| 903 | 898 | typedef typename TR::Digraph Digraph; |
| 904 | 899 | |
| 905 | 900 | typedef typename Digraph::Node Node; |
| … |
… |
|
| 907 | 902 | typedef typename Digraph::Arc Arc; |
| 908 | 903 | typedef typename Digraph::OutArcIt OutArcIt; |
| 909 | 904 | |
| 910 | | ///\brief The type of the map that stores the predecessor |
| 911 | | ///arcs of the DFS paths. |
| 912 | 905 | typedef typename TR::PredMap PredMap; |
| 913 | | ///\brief The type of the map that stores the distances of the nodes. |
| 914 | 906 | typedef typename TR::DistMap DistMap; |
| 915 | | ///\brief The type of the map that indicates which nodes are reached. |
| 916 | 907 | typedef typename TR::ReachedMap ReachedMap; |
| 917 | | ///\brief The type of the map that indicates which nodes are processed. |
| 918 | 908 | typedef typename TR::ProcessedMap ProcessedMap; |
| 919 | | ///The type of the DFS paths |
| 920 | 909 | typedef typename TR::Path Path; |
| 921 | 910 | |
| 922 | 911 | public: |
| … |
… |
|
| 999 | 988 | static PredMap *createPredMap(const Digraph &) { return 0; }; |
| 1000 | 989 | SetPredMapBase(const TR &b) : TR(b) {} |
| 1001 | 990 | }; |
| 1002 | | ///\brief \ref named-func-param "Named parameter" |
| 1003 | | ///for setting PredMap object. |
| | 991 | |
| | 992 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 993 | ///the predecessor map. |
| 1004 | 994 | /// |
| 1005 | | ///\ref named-func-param "Named parameter" |
| 1006 | | ///for setting PredMap object. |
| | 995 | ///\ref named-templ-param "Named parameter" function for setting |
| | 996 | ///the map that stores the predecessor arcs of the nodes. |
| 1007 | 997 | template<class T> |
| 1008 | 998 | DfsWizard<SetPredMapBase<T> > predMap(const T &t) |
| 1009 | 999 | { |
| … |
… |
|
| 1017 | 1007 | static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
| 1018 | 1008 | SetReachedMapBase(const TR &b) : TR(b) {} |
| 1019 | 1009 | }; |
| 1020 | | ///\brief \ref named-func-param "Named parameter" |
| 1021 | | ///for setting ReachedMap object. |
| | 1010 | |
| | 1011 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1012 | ///the reached map. |
| 1022 | 1013 | /// |
| 1023 | | /// \ref named-func-param "Named parameter" |
| 1024 | | ///for setting ReachedMap object. |
| | 1014 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1015 | ///the map that indicates which nodes are reached. |
| 1025 | 1016 | template<class T> |
| 1026 | 1017 | DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) |
| 1027 | 1018 | { |
| … |
… |
|
| 1035 | 1026 | static DistMap *createDistMap(const Digraph &) { return 0; }; |
| 1036 | 1027 | SetDistMapBase(const TR &b) : TR(b) {} |
| 1037 | 1028 | }; |
| 1038 | | ///\brief \ref named-func-param "Named parameter" |
| 1039 | | ///for setting DistMap object. |
| | 1029 | |
| | 1030 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1031 | ///the distance map. |
| 1040 | 1032 | /// |
| 1041 | | /// \ref named-func-param "Named parameter" |
| 1042 | | ///for setting DistMap object. |
| | 1033 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1034 | ///the map that stores the distances of the nodes calculated |
| | 1035 | ///by the algorithm. |
| 1043 | 1036 | template<class T> |
| 1044 | 1037 | DfsWizard<SetDistMapBase<T> > distMap(const T &t) |
| 1045 | 1038 | { |
| … |
… |
|
| 1053 | 1046 | static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
| 1054 | 1047 | SetProcessedMapBase(const TR &b) : TR(b) {} |
| 1055 | 1048 | }; |
| 1056 | | ///\brief \ref named-func-param "Named parameter" |
| 1057 | | ///for setting ProcessedMap object. |
| | 1049 | |
| | 1050 | ///\brief \ref named-func-param "Named parameter" for setting |
| | 1051 | ///the processed map. |
| 1058 | 1052 | /// |
| 1059 | | /// \ref named-func-param "Named parameter" |
| 1060 | | ///for setting ProcessedMap object. |
| | 1053 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1054 | ///the map that indicates which nodes are processed. |
| 1061 | 1055 | template<class T> |
| 1062 | 1056 | DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
| 1063 | 1057 | { |
| … |
… |
|
| 1208 | 1202 | /// \brief The type of the map that indicates which nodes are reached. |
| 1209 | 1203 | /// |
| 1210 | 1204 | /// The type of the map that indicates which nodes are reached. |
| 1211 | | /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| | 1205 | /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 1212 | 1206 | typedef typename Digraph::template NodeMap<bool> ReachedMap; |
| 1213 | 1207 | |
| 1214 | 1208 | /// \brief Instantiates a ReachedMap. |
| … |
… |
|
| 1620 | 1614 | |
| 1621 | 1615 | ///@{ |
| 1622 | 1616 | |
| 1623 | | /// \brief Checks if a node is reached from the root(s). |
| | 1617 | /// \brief Checks if the given node is reached from the root(s). |
| 1624 | 1618 | /// |
| 1625 | 1619 | /// Returns \c true if \c v is reached from the root(s). |
| 1626 | 1620 | /// |
diff --git a/lemon/dijkstra.h b/lemon/dijkstra.h
|
a
|
b
|
|
| 70 | 70 | ///The type of the map that stores the arc lengths. |
| 71 | 71 | |
| 72 | 72 | ///The type of the map that stores the arc lengths. |
| 73 | | ///It must meet the \ref concepts::ReadMap "ReadMap" concept. |
| | 73 | ///It must conform to the \ref concepts::ReadMap "ReadMap" concept. |
| 74 | 74 | typedef LEN LengthMap; |
| 75 | | ///The type of the length of the arcs. |
| | 75 | ///The type of the arc lengths. |
| 76 | 76 | typedef typename LEN::Value Value; |
| 77 | 77 | |
| 78 | 78 | /// Operation traits for %Dijkstra algorithm. |
| … |
… |
|
| 116 | 116 | /// |
| 117 | 117 | ///The type of the map that stores the predecessor |
| 118 | 118 | ///arcs of the shortest paths. |
| 119 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 119 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 120 | 120 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 121 | 121 | ///Instantiates a \c PredMap. |
| 122 | 122 | |
| … |
… |
|
| 131 | 131 | ///The type of the map that indicates which nodes are processed. |
| 132 | 132 | |
| 133 | 133 | ///The type of the map that indicates which nodes are processed. |
| 134 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 134 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 135 | 135 | ///By default it is a NullMap. |
| 136 | 136 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 137 | 137 | ///Instantiates a \c ProcessedMap. |
| … |
… |
|
| 151 | 151 | ///The type of the map that stores the distances of the nodes. |
| 152 | 152 | |
| 153 | 153 | ///The type of the map that stores the distances of the nodes. |
| 154 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 154 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 155 | 155 | typedef typename Digraph::template NodeMap<typename LEN::Value> DistMap; |
| 156 | 156 | ///Instantiates a \c DistMap. |
| 157 | 157 | |
| … |
… |
|
| 169 | 169 | /// \ingroup shortest_path |
| 170 | 170 | ///This class provides an efficient implementation of the %Dijkstra algorithm. |
| 171 | 171 | /// |
| | 172 | ///The %Dijkstra algorithm solves the single-source shortest path problem |
| | 173 | ///when all arc lengths are non-negative. If there are negative lengths, |
| | 174 | ///the BellmanFord algorithm should be used instead. |
| | 175 | /// |
| 172 | 176 | ///The arc lengths are passed to the algorithm using a |
| 173 | 177 | ///\ref concepts::ReadMap "ReadMap", |
| 174 | 178 | ///so it is easy to change it to any kind of length. |
| … |
… |
|
| 201 | 205 | ///The type of the digraph the algorithm runs on. |
| 202 | 206 | typedef typename TR::Digraph Digraph; |
| 203 | 207 | |
| 204 | | ///The type of the length of the arcs. |
| | 208 | ///The type of the arc lengths. |
| 205 | 209 | typedef typename TR::LengthMap::Value Value; |
| 206 | 210 | ///The type of the map that stores the arc lengths. |
| 207 | 211 | typedef typename TR::LengthMap LengthMap; |
| … |
… |
|
| 304 | 308 | /// |
| 305 | 309 | ///\ref named-templ-param "Named parameter" for setting |
| 306 | 310 | ///\c PredMap type. |
| 307 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 311 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 308 | 312 | template <class T> |
| 309 | 313 | struct SetPredMap |
| 310 | 314 | : public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > { |
| … |
… |
|
| 325 | 329 | /// |
| 326 | 330 | ///\ref named-templ-param "Named parameter" for setting |
| 327 | 331 | ///\c DistMap type. |
| 328 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 332 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 329 | 333 | template <class T> |
| 330 | 334 | struct SetDistMap |
| 331 | 335 | : public Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > { |
| … |
… |
|
| 346 | 350 | /// |
| 347 | 351 | ///\ref named-templ-param "Named parameter" for setting |
| 348 | 352 | ///\c ProcessedMap type. |
| 349 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 353 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 350 | 354 | template <class T> |
| 351 | 355 | struct SetProcessedMap |
| 352 | 356 | : public Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > { |
| … |
… |
|
| 443 | 447 | /// |
| 444 | 448 | ///\ref named-templ-param "Named parameter" for setting |
| 445 | 449 | ///\c OperationTraits type. |
| | 450 | /// For more information see \ref DijkstraDefaultOperationTraits. |
| 446 | 451 | template <class T> |
| 447 | 452 | struct SetOperationTraits |
| 448 | 453 | : public Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> > { |
| … |
… |
|
| 801 | 806 | ///\name Query Functions |
| 802 | 807 | ///The results of the %Dijkstra algorithm can be obtained using these |
| 803 | 808 | ///functions.\n |
| 804 | | ///Either \ref run(Node) "run()" or \ref start() should be called |
| | 809 | ///Either \ref run(Node) "run()" or \ref init() should be called |
| 805 | 810 | ///before using them. |
| 806 | 811 | |
| 807 | 812 | ///@{ |
| 808 | 813 | |
| 809 | | ///The shortest path to a node. |
| | 814 | ///The shortest path to the given node. |
| 810 | 815 | |
| 811 | | ///Returns the shortest path to a node. |
| | 816 | ///Returns the shortest path to the given node from the root(s). |
| 812 | 817 | /// |
| 813 | 818 | ///\warning \c t should be reached from the root(s). |
| 814 | 819 | /// |
| … |
… |
|
| 816 | 821 | ///must be called before using this function. |
| 817 | 822 | Path path(Node t) const { return Path(*G, *_pred, t); } |
| 818 | 823 | |
| 819 | | ///The distance of a node from the root(s). |
| | 824 | ///The distance of the given node from the root(s). |
| 820 | 825 | |
| 821 | | ///Returns the distance of a node from the root(s). |
| | 826 | ///Returns the distance of the given node from the root(s). |
| 822 | 827 | /// |
| 823 | 828 | ///\warning If node \c v is not reached from the root(s), then |
| 824 | 829 | ///the return value of this function is undefined. |
| … |
… |
|
| 827 | 832 | ///must be called before using this function. |
| 828 | 833 | Value dist(Node v) const { return (*_dist)[v]; } |
| 829 | 834 | |
| 830 | | ///Returns the 'previous arc' of the shortest path tree for a node. |
| 831 | | |
| | 835 | ///\brief Returns the 'previous arc' of the shortest path tree for |
| | 836 | ///the given node. |
| | 837 | /// |
| 832 | 838 | ///This function returns the 'previous arc' of the shortest path |
| 833 | 839 | ///tree for the node \c v, i.e. it returns the last arc of a |
| 834 | 840 | ///shortest path from a root to \c v. It is \c INVALID if \c v |
| 835 | 841 | ///is not reached from the root(s) or if \c v is a root. |
| 836 | 842 | /// |
| 837 | 843 | ///The shortest path tree used here is equal to the shortest path |
| 838 | | ///tree used in \ref predNode(). |
| | 844 | ///tree used in \ref predNode() and \ref predMap(). |
| 839 | 845 | /// |
| 840 | 846 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 841 | 847 | ///must be called before using this function. |
| 842 | 848 | Arc predArc(Node v) const { return (*_pred)[v]; } |
| 843 | 849 | |
| 844 | | ///Returns the 'previous node' of the shortest path tree for a node. |
| 845 | | |
| | 850 | ///\brief Returns the 'previous node' of the shortest path tree for |
| | 851 | ///the given node. |
| | 852 | /// |
| 846 | 853 | ///This function returns the 'previous node' of the shortest path |
| 847 | 854 | ///tree for the node \c v, i.e. it returns the last but one node |
| 848 | | ///from a shortest path from a root to \c v. It is \c INVALID |
| | 855 | ///of a shortest path from a root to \c v. It is \c INVALID |
| 849 | 856 | ///if \c v is not reached from the root(s) or if \c v is a root. |
| 850 | 857 | /// |
| 851 | 858 | ///The shortest path tree used here is equal to the shortest path |
| 852 | | ///tree used in \ref predArc(). |
| | 859 | ///tree used in \ref predArc() and \ref predMap(). |
| 853 | 860 | /// |
| 854 | 861 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 855 | 862 | ///must be called before using this function. |
| … |
… |
|
| 870 | 877 | ///predecessor arcs. |
| 871 | 878 | /// |
| 872 | 879 | ///Returns a const reference to the node map that stores the predecessor |
| 873 | | ///arcs, which form the shortest path tree. |
| | 880 | ///arcs, which form the shortest path tree (forest). |
| 874 | 881 | /// |
| 875 | 882 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| 876 | 883 | ///must be called before using this function. |
| 877 | 884 | const PredMap &predMap() const { return *_pred;} |
| 878 | 885 | |
| 879 | | ///Checks if a node is reached from the root(s). |
| | 886 | ///Checks if the given node is reached from the root(s). |
| 880 | 887 | |
| 881 | 888 | ///Returns \c true if \c v is reached from the root(s). |
| 882 | 889 | /// |
| … |
… |
|
| 895 | 902 | bool processed(Node v) const { return (*_heap_cross_ref)[v] == |
| 896 | 903 | Heap::POST_HEAP; } |
| 897 | 904 | |
| 898 | | ///The current distance of a node from the root(s). |
| | 905 | ///The current distance of the given node from the root(s). |
| 899 | 906 | |
| 900 | | ///Returns the current distance of a node from the root(s). |
| | 907 | ///Returns the current distance of the given node from the root(s). |
| 901 | 908 | ///It may be decreased in the following processes. |
| 902 | 909 | /// |
| 903 | 910 | ///\pre Either \ref run(Node) "run()" or \ref init() |
| … |
… |
|
| 924 | 931 | ///The type of the map that stores the arc lengths. |
| 925 | 932 | |
| 926 | 933 | ///The type of the map that stores the arc lengths. |
| 927 | | ///It must meet the \ref concepts::ReadMap "ReadMap" concept. |
| | 934 | ///It must conform to the \ref concepts::ReadMap "ReadMap" concept. |
| 928 | 935 | typedef LEN LengthMap; |
| 929 | | ///The type of the length of the arcs. |
| | 936 | ///The type of the arc lengths. |
| 930 | 937 | typedef typename LEN::Value Value; |
| 931 | 938 | |
| 932 | 939 | /// Operation traits for Dijkstra algorithm. |
| … |
… |
|
| 973 | 980 | /// |
| 974 | 981 | ///The type of the map that stores the predecessor |
| 975 | 982 | ///arcs of the shortest paths. |
| 976 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 983 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 977 | 984 | typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
| 978 | 985 | ///Instantiates a PredMap. |
| 979 | 986 | |
| … |
… |
|
| 988 | 995 | ///The type of the map that indicates which nodes are processed. |
| 989 | 996 | |
| 990 | 997 | ///The type of the map that indicates which nodes are processed. |
| 991 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 998 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 992 | 999 | ///By default it is a NullMap. |
| 993 | 1000 | typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
| 994 | 1001 | ///Instantiates a ProcessedMap. |
| … |
… |
|
| 1008 | 1015 | ///The type of the map that stores the distances of the nodes. |
| 1009 | 1016 | |
| 1010 | 1017 | ///The type of the map that stores the distances of the nodes. |
| 1011 | | ///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
| | 1018 | ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. |
| 1012 | 1019 | typedef typename Digraph::template NodeMap<typename LEN::Value> DistMap; |
| 1013 | 1020 | ///Instantiates a DistMap. |
| 1014 | 1021 | |
| … |
… |
|
| 1023 | 1030 | ///The type of the shortest paths. |
| 1024 | 1031 | |
| 1025 | 1032 | ///The type of the shortest paths. |
| 1026 | | ///It must meet the \ref concepts::Path "Path" concept. |
| | 1033 | ///It must conform to the \ref concepts::Path "Path" concept. |
| 1027 | 1034 | typedef lemon::Path<Digraph> Path; |
| 1028 | 1035 | }; |
| 1029 | 1036 | |
| 1030 | 1037 | /// Default traits class used by DijkstraWizard |
| 1031 | 1038 | |
| 1032 | | /// To make it easier to use Dijkstra algorithm |
| 1033 | | /// we have created a wizard class. |
| 1034 | | /// This \ref DijkstraWizard class needs default traits, |
| 1035 | | /// as well as the \ref Dijkstra class. |
| 1036 | | /// The \ref DijkstraWizardBase is a class to be the default traits of the |
| 1037 | | /// \ref DijkstraWizard class. |
| | 1039 | /// Default traits class used by DijkstraWizard. |
| | 1040 | /// \tparam GR The type of the digraph. |
| | 1041 | /// \tparam LEN The type of the length map. |
| 1038 | 1042 | template<typename GR, typename LEN> |
| 1039 | 1043 | class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LEN> |
| 1040 | 1044 | { |
| … |
… |
|
| 1093 | 1097 | { |
| 1094 | 1098 | typedef TR Base; |
| 1095 | 1099 | |
| 1096 | | ///The type of the digraph the algorithm runs on. |
| 1097 | 1100 | typedef typename TR::Digraph Digraph; |
| 1098 | 1101 | |
| 1099 | 1102 | typedef typename Digraph::Node Node; |
| … |
… |
|
| 1101 | 1104 | typedef typename Digraph::Arc Arc; |
| 1102 | 1105 | typedef typename Digraph::OutArcIt OutArcIt; |
| 1103 | 1106 | |
| 1104 | | ///The type of the map that stores the arc lengths. |
| 1105 | 1107 | typedef typename TR::LengthMap LengthMap; |
| 1106 | | ///The type of the length of the arcs. |
| 1107 | 1108 | typedef typename LengthMap::Value Value; |
| 1108 | | ///\brief The type of the map that stores the predecessor |
| 1109 | | ///arcs of the shortest paths. |
| 1110 | 1109 | typedef typename TR::PredMap PredMap; |
| 1111 | | ///The type of the map that stores the distances of the nodes. |
| 1112 | 1110 | typedef typename TR::DistMap DistMap; |
| 1113 | | ///The type of the map that indicates which nodes are processed. |
| 1114 | 1111 | typedef typename TR::ProcessedMap ProcessedMap; |
| 1115 | | ///The type of the shortest paths |
| 1116 | 1112 | typedef typename TR::Path Path; |
| 1117 | | ///The heap type used by the dijkstra algorithm. |
| 1118 | 1113 | typedef typename TR::Heap Heap; |
| 1119 | 1114 | |
| 1120 | 1115 | public: |
| … |
… |
|
| 1186 | 1181 | static PredMap *createPredMap(const Digraph &) { return 0; }; |
| 1187 | 1182 | SetPredMapBase(const TR &b) : TR(b) {} |
| 1188 | 1183 | }; |
| 1189 | | ///\brief \ref named-func-param "Named parameter" |
| 1190 | | ///for setting PredMap object. |
| | 1184 | |
| | 1185 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1186 | ///the predecessor map. |
| 1191 | 1187 | /// |
| 1192 | | ///\ref named-func-param "Named parameter" |
| 1193 | | ///for setting PredMap object. |
| | 1188 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1189 | ///the map that stores the predecessor arcs of the nodes. |
| 1194 | 1190 | template<class T> |
| 1195 | 1191 | DijkstraWizard<SetPredMapBase<T> > predMap(const T &t) |
| 1196 | 1192 | { |
| … |
… |
|
| 1204 | 1200 | static DistMap *createDistMap(const Digraph &) { return 0; }; |
| 1205 | 1201 | SetDistMapBase(const TR &b) : TR(b) {} |
| 1206 | 1202 | }; |
| 1207 | | ///\brief \ref named-func-param "Named parameter" |
| 1208 | | ///for setting DistMap object. |
| | 1203 | |
| | 1204 | ///\brief \ref named-templ-param "Named parameter" for setting |
| | 1205 | ///the distance map. |
| 1209 | 1206 | /// |
| 1210 | | ///\ref named-func-param "Named parameter" |
| 1211 | | ///for setting DistMap object. |
| | 1207 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1208 | ///the map that stores the distances of the nodes calculated |
| | 1209 | ///by the algorithm. |
| 1212 | 1210 | template<class T> |
| 1213 | 1211 | DijkstraWizard<SetDistMapBase<T> > distMap(const T &t) |
| 1214 | 1212 | { |
| … |
… |
|
| 1222 | 1220 | static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
| 1223 | 1221 | SetProcessedMapBase(const TR &b) : TR(b) {} |
| 1224 | 1222 | }; |
| 1225 | | ///\brief \ref named-func-param "Named parameter" |
| 1226 | | ///for setting ProcessedMap object. |
| | 1223 | |
| | 1224 | ///\brief \ref named-func-param "Named parameter" for setting |
| | 1225 | ///the processed map. |
| 1227 | 1226 | /// |
| 1228 | | /// \ref named-func-param "Named parameter" |
| 1229 | | ///for setting ProcessedMap object. |
| | 1227 | ///\ref named-templ-param "Named parameter" function for setting |
| | 1228 | ///the map that indicates which nodes are processed. |
| 1230 | 1229 | template<class T> |
| 1231 | 1230 | DijkstraWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
| 1232 | 1231 | { |
| … |
… |
|
| 1239 | 1238 | typedef T Path; |
| 1240 | 1239 | SetPathBase(const TR &b) : TR(b) {} |
| 1241 | 1240 | }; |
| | 1241 | |
| 1242 | 1242 | ///\brief \ref named-func-param "Named parameter" |
| 1243 | 1243 | ///for getting the shortest path to the target node. |
| 1244 | 1244 | /// |