# HG changeset patch
# User alpar
# Date 1094713751 0
# Node ID 157115b5814a00b9c66106e915e94692171c3837
# Parent afba7fbbb23985b89265ba0c300ab30d9a465771
Shorter template parameter names to be more readable in Doxygen.
diff -r afba7fbbb239 -r 157115b5814a src/hugo/kruskal.h
--- a/src/hugo/kruskal.h Wed Sep 08 12:12:16 2004 +0000
+++ b/src/hugo/kruskal.h Thu Sep 09 07:09:11 2004 +0000
@@ -21,6 +21,7 @@
///
///Kruskal's algorithm to compute a minimum cost tree.
+///\weakgroup spantree
namespace hugo {
/// \addtogroup spantree
@@ -34,7 +35,7 @@
///
/// \param in This object is used to describe the edge costs. It must
/// be an STL compatible 'Forward Container'
- /// with std::pair as its value_type,
+ /// with std::pair as its value_type,
/// where X is the type of the costs. It must contain every edge in
/// cost-ascending order.
///\par
@@ -52,20 +53,20 @@
///
/// \return The cost of the found tree.
- template
- typename InputEdgeOrder::value_type::second_type
- kruskal(Graph const& G, InputEdgeOrder const& in,
- OutBoolMap& out)
+ template
+ typename IN::value_type::second_type
+ kruskal(GR const& G, IN const& in,
+ OUT& out)
{
- typedef typename InputEdgeOrder::value_type::second_type EdgeCost;
- typedef typename Graph::template NodeMap NodeIntMap;
- typedef typename Graph::Node Node;
+ typedef typename IN::value_type::second_type EdgeCost;
+ typedef typename GR::template NodeMap NodeIntMap;
+ typedef typename GR::Node Node;
NodeIntMap comp(G, -1);
UnionFind uf(comp);
EdgeCost tot_cost = 0;
- for (typename InputEdgeOrder::const_iterator p = in.begin();
+ for (typename IN::const_iterator p = in.begin();
p!=in.end(); ++p ) {
if ( uf.join(G.head((*p).first),
G.tail((*p).first)) ) {
@@ -83,7 +84,7 @@
///\bug What is this? Or why doesn't it work?
///
- template
+ template
class NonConstMapWr {
const Map &m;
public:
@@ -91,17 +92,17 @@
NonConstMapWr(const Map &_m) : m(_m) {}
- template
+ template
void set(KeyType const& k, ValueType const &v) const { m.set(k,v); }
};
- template
+ template
inline
- typename InputEdgeOrder::ValueType
- kruskal(Graph const& G, InputEdgeOrder const& edges,
- OutBoolMap const& out_map)
+ typename IN::ValueType
+ kruskal(GR const& G, IN const& edges,
+ OUT const& out_map)
{
- NonConstMapWr map_wr(out_map);
+ NonConstMapWr map_wr(out_map);
return kruskal(G, edges, map_wr);
}
@@ -115,7 +116,7 @@
///
/// \sa makeKruskalMapInput()
///
- ///\param Graph The type of the graph the algorithm runs on.
+ ///\param GR The type of the graph the algorithm runs on.
///\param Map An edge map containing the cost of the edges.
///\par
///The cost type can be any type satisfying
@@ -123,13 +124,13 @@
///concept if it also has an operator+() implemented. (It is necessary for
///computing the total cost of the tree).
///
- template
+ template
class KruskalMapInput
- : public std::vector< std::pair > {
public:
- typedef std::vector< std::pair > Parent;
typedef typename Parent::value_type value_type;
@@ -148,8 +149,8 @@
std::sort(this->begin(), this->end(), comparePair());
}
- KruskalMapInput(Graph const& G, Map const& m) {
- typedef typename Graph::EdgeIt EdgeIt;
+ KruskalMapInput(GR const& G, Map const& m) {
+ typedef typename GR::EdgeIt EdgeIt;
this->clear();
for(EdgeIt e(G);e!=INVALID;++e) push_back(make_pair(e, m[e]));
@@ -176,11 +177,11 @@
///
///\return An appropriate input source for \ref kruskal().
///
- template
+ template
inline
- KruskalMapInput makeKruskalMapInput(const Graph &G,const Map &m)
+ KruskalMapInput makeKruskalMapInput(const GR &G,const Map &m)
{
- return KruskalMapInput(G,m);
+ return KruskalMapInput(G,m);
}
@@ -194,7 +195,7 @@
/// \bug Missing documentation.
/// \todo This class may be of wider usage, therefore it could move to
/// maps.h
- template
+ template
class SequenceOutput {
mutable Iterator it;
@@ -207,7 +208,7 @@
void set(KeyType const& k, bool v) const { if(v) {*it=k; ++it;} }
};
- template
+ template
inline
SequenceOutput
makeSequenceOutput(Iterator it) {
@@ -240,14 +241,14 @@
/// \return The cost of the found tree.
- template
+ template
inline
- typename EdgeCostMap::ValueType
- kruskalEdgeMap(Graph const& G,
- EdgeCostMap const& in,
- RetEdgeBoolMap &out) {
+ typename IN::ValueType
+ kruskalEdgeMap(GR const& G,
+ IN const& in,
+ RET &out) {
return kruskal(G,
- KruskalMapInput(G,in),
+ KruskalMapInput(G,in),
out);
}
@@ -266,11 +267,11 @@
///computing the total cost of the tree).
///
/// \retval out This must be an iteraror of an STL Container with
- /// Graph::Edge as its value_type.
+ /// GR::Edge as its value_type.
/// The algorithm copies the elements of the found tree into this sequence.
/// For example, if we know that the spanning tree of the graph \c G has
/// say 53 edges then
- /// we can put its edges into a vector \c tree with a code like this.
+ /// we can put its edges into a STL vector \c tree with a code like this.
/// \code
/// std::vector tree(53);
/// kruskalEdgeMap_IteratorOut(G,cost,tree.begin());
@@ -284,16 +285,16 @@
/// \return The cost of the found tree.
///
/// \bug its name does not follow the coding style.
- template
+ template
inline
- typename EdgeCostMap::ValueType
- kruskalEdgeMap_IteratorOut(const Graph& G,
- const EdgeCostMap& in,
- RetIterator out)
+ typename IN::ValueType
+ kruskalEdgeMap_IteratorOut(const GR& G,
+ const IN& in,
+ RET out)
{
- SequenceOutput _out(out);
+ SequenceOutput _out(out);
return kruskal(G,
- KruskalMapInput(G, in),
+ KruskalMapInput(G, in),
_out);
}