diff --git a/lemon/suurballe.h b/lemon/suurballe.h
--- a/lemon/suurballe.h
+++ b/lemon/suurballe.h
@@ -34,6 +34,49 @@
namespace lemon {
+ /// \brief Default traits class of Suurballe algorithm.
+ ///
+ /// Default traits class of Suurballe algorithm.
+ /// \tparam GR The digraph type the algorithm runs on.
+ /// \tparam LEN The type of the length map.
+ /// The default value is GR::ArcMap.
+#ifdef DOXYGEN
+ template
+#else
+ template < typename GR,
+ typename LEN = typename GR::template ArcMap >
+#endif
+ struct SuurballeDefaultTraits
+ {
+ /// The type of the digraph.
+ typedef GR Digraph;
+ /// The type of the length map.
+ typedef LEN LengthMap;
+ /// The type of the lengths.
+ typedef typename LEN::Value Length;
+ /// The type of the flow map.
+ typedef typename GR::template ArcMap FlowMap;
+ /// The type of the potential map.
+ typedef typename GR::template NodeMap PotentialMap;
+
+ /// \brief The path type
+ ///
+ /// The type used for storing the found arc-disjoint paths.
+ /// It must conform to the \ref lemon::concepts::Path "Path" concept
+ /// and it must have an \c addBack() function.
+ typedef lemon::Path Path;
+
+ /// The cross reference type used for the heap.
+ typedef typename GR::template NodeMap HeapCrossRef;
+
+ /// \brief The heap type used for internal Dijkstra computations.
+ ///
+ /// The type of the heap used for internal Dijkstra computations.
+ /// It must conform to the \ref lemon::concepts::Heap "Heap" concept
+ /// and its priority type must be \c Length.
+ typedef BinHeap Heap;
+ };
+
/// \addtogroup shortest_path
/// @{
@@ -61,10 +104,11 @@
/// \note For finding \e node-disjoint paths, this algorithm can be used
/// along with the \ref SplitNodes adaptor.
#ifdef DOXYGEN
- template
+ template
#else
template < typename GR,
- typename LEN = typename GR::template ArcMap >
+ typename LEN = typename GR::template ArcMap,
+ typename TR = SuurballeDefaultTraits >
#endif
class Suurballe
{
@@ -75,32 +119,29 @@
public:
- /// The type of the digraph the algorithm runs on.
- typedef GR Digraph;
+ /// The type of the digraph.
+ typedef typename TR::Digraph Digraph;
/// The type of the length map.
- typedef LEN LengthMap;
+ typedef typename TR::LengthMap LengthMap;
/// The type of the lengths.
- typedef typename LengthMap::Value Length;
-#ifdef DOXYGEN
+ typedef typename TR::Length Length;
+
/// The type of the flow map.
- typedef GR::ArcMap FlowMap;
+ typedef typename TR::FlowMap FlowMap;
/// The type of the potential map.
- typedef GR::NodeMap PotentialMap;
-#else
- /// The type of the flow map.
- typedef typename Digraph::template ArcMap FlowMap;
- /// The type of the potential map.
- typedef typename Digraph::template NodeMap PotentialMap;
-#endif
+ typedef typename TR::PotentialMap PotentialMap;
+ /// The type of the path structures.
+ typedef typename TR::Path Path;
+ /// The cross reference type used for the heap.
+ typedef typename TR::HeapCrossRef HeapCrossRef;
+ /// The heap type used for internal Dijkstra computations.
+ typedef typename TR::Heap Heap;
- /// The type of the path structures.
- typedef SimplePath Path;
+ /// The \ref SuurballeDefaultTraits "traits class" of the algorithm.
+ typedef TR Traits;
private:
- typedef typename Digraph::template NodeMap HeapCrossRef;
- typedef BinHeap Heap;
-
// ResidualDijkstra is a special implementation of the
// Dijkstra algorithm for finding shortest paths in the
// residual network with respect to the reduced arc lengths
@@ -254,6 +295,83 @@
}; //class ResidualDijkstra
+ public:
+
+ /// \name Named Template Parameters
+ /// @{
+
+ template
+ struct SetFlowMapTraits : public Traits {
+ typedef T FlowMap;
+ };
+
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// \c FlowMap type.
+ ///
+ /// \ref named-templ-param "Named parameter" for setting
+ /// \c FlowMap type.
+ template
+ struct SetFlowMap
+ : public Suurballe > {
+ typedef Suurballe > Create;
+ };
+
+ template
+ struct SetPotentialMapTraits : public Traits {
+ typedef T PotentialMap;
+ };
+
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// \c PotentialMap type.
+ ///
+ /// \ref named-templ-param "Named parameter" for setting
+ /// \c PotentialMap type.
+ template
+ struct SetPotentialMap
+ : public Suurballe > {
+ typedef Suurballe > Create;
+ };
+
+ template
+ struct SetPathTraits : public Traits {
+ typedef T Path;
+ };
+
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// \c %Path type.
+ ///
+ /// \ref named-templ-param "Named parameter" for setting \c %Path type.
+ /// It must conform to the \ref lemon::concepts::Path "Path" concept
+ /// and it must have an \c addBack() function.
+ template
+ struct SetPath
+ : public Suurballe > {
+ typedef Suurballe > Create;
+ };
+
+ template
+ struct SetHeapTraits : public Traits {
+ typedef H Heap;
+ typedef CR HeapCrossRef;
+ };
+
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// \c Heap and \c HeapCrossRef types.
+ ///
+ /// \ref named-templ-param "Named parameter" for setting \c Heap
+ /// and \c HeapCrossRef types with automatic allocation.
+ /// They will be used for internal Dijkstra computations.
+ /// The heap type must conform to the \ref lemon::concepts::Heap "Heap"
+ /// concept and its priority type must be \c Length.
+ template >
+ struct SetHeap
+ : public Suurballe > {
+ typedef Suurballe > Create;
+ };
+
+ /// @}
+
private:
// The digraph the algorithm runs on