COIN-OR::LEMON - Graph Library

Changeset 405:6b9057cdcd8b in lemon-1.2 for lemon/dijkstra.h


Ignore:
Timestamp:
11/30/08 19:17:51 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Doc improvements for Bfs, Dfs, Dijkstra (#185)

  • More precise references to overloaded member functions.
  • Hide the doc of the traits class parameters.
  • Better doc for named groups.
  • More precise doc for the case of multiple sources in Dfs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dijkstra.h

    r313 r405  
    203203  ///
    204204  ///\tparam GR The type of the digraph the algorithm runs on.
    205   ///The default value is \ref ListDigraph.
    206   ///The value of GR is not used directly by \ref Dijkstra, it is only
    207   ///passed to \ref DijkstraDefaultTraits.
    208   ///\tparam LM A readable arc map that determines the lengths of the
    209   ///arcs. It is read once for each arc, so the map may involve in
     205  ///The default type is \ref ListDigraph.
     206  ///\tparam LM A \ref concepts::ReadMap "readable" arc map that specifies
     207  ///the lengths of the arcs.
     208  ///It is read once for each arc, so the map may involve in
    210209  ///relatively time consuming process to compute the arc lengths if
    211210  ///it is necessary. The default map type is \ref
    212   ///concepts::Digraph::ArcMap "Digraph::ArcMap<int>".
    213   ///The value of LM is not used directly by \ref Dijkstra, it is only
    214   ///passed to \ref DijkstraDefaultTraits.
    215   ///\tparam TR Traits class to set various data types used by the algorithm.
    216   ///The default traits class is \ref DijkstraDefaultTraits
    217   ///"DijkstraDefaultTraits<GR,LM>". See \ref DijkstraDefaultTraits
    218   ///for the documentation of a Dijkstra traits class.
     211  ///concepts::Digraph::ArcMap "GR::ArcMap<int>".
    219212#ifdef DOXYGEN
    220213  template <typename GR, typename LM, typename TR>
     
    250243    typedef typename TR::OperationTraits OperationTraits;
    251244
    252     ///The traits class.
     245    ///The \ref DijkstraDefaultTraits "traits class" of the algorithm.
    253246    typedef TR Traits;
    254247
     
    332325    ///\ref named-templ-param "Named parameter" for setting
    333326    ///PredMap type.
     327    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    334328    template <class T>
    335329    struct SetPredMap
     
    352346    ///\ref named-templ-param "Named parameter" for setting
    353347    ///DistMap type.
     348    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    354349    template <class T>
    355350    struct SetDistMap
     
    372367    ///\ref named-templ-param "Named parameter" for setting
    373368    ///ProcessedMap type.
     369    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    374370    template <class T>
    375371    struct SetProcessedMap
     
    412408    };
    413409    ///\brief \ref named-templ-param "Named parameter" for setting
    414     ///heap and cross reference type
     410    ///heap and cross reference types
    415411    ///
    416412    ///\ref named-templ-param "Named parameter" for setting heap and cross
    417     ///reference type.
     413    ///reference types. If this named parameter is used, then external
     414    ///heap and cross reference objects must be passed to the algorithm
     415    ///using the \ref heap() function before calling \ref run(Node) "run()"
     416    ///or \ref init().
     417    ///\sa SetStandardHeap
    418418    template <class H, class CR = typename Digraph::template NodeMap<int> >
    419419    struct SetHeap
     
    435435    };
    436436    ///\brief \ref named-templ-param "Named parameter" for setting
    437     ///heap and cross reference type with automatic allocation
     437    ///heap and cross reference types with automatic allocation
    438438    ///
    439439    ///\ref named-templ-param "Named parameter" for setting heap and cross
    440     ///reference type. It can allocate the heap and the cross reference
    441     ///object if the cross reference's constructor waits for the digraph as
    442     ///parameter and the heap's constructor waits for the cross reference.
     440    ///reference types with automatic allocation.
     441    ///They should have standard constructor interfaces to be able to
     442    ///automatically created by the algorithm (i.e. the digraph should be
     443    ///passed to the constructor of the cross reference and the cross
     444    ///reference should be passed to the constructor of the heap).
     445    ///However external heap and cross reference objects could also be
     446    ///passed to the algorithm using the \ref heap() function before
     447    ///calling \ref run(Node) "run()" or \ref init().
     448    ///\sa SetHeap
    443449    template <class H, class CR = typename Digraph::template NodeMap<int> >
    444450    struct SetStandardHeap
     
    510516
    511517    ///Sets the map that stores the predecessor arcs.
    512     ///If you don't use this function before calling \ref run(),
    513     ///it will allocate one. The destructor deallocates this
    514     ///automatically allocated map, of course.
     518    ///If you don't use this function before calling \ref run(Node) "run()"
     519    ///or \ref init(), an instance will be allocated automatically.
     520    ///The destructor deallocates this automatically allocated map,
     521    ///of course.
    515522    ///\return <tt> (*this) </tt>
    516523    Dijkstra &predMap(PredMap &m)
     
    527534
    528535    ///Sets the map that indicates which nodes are processed.
    529     ///If you don't use this function before calling \ref run(),
    530     ///it will allocate one. The destructor deallocates this
    531     ///automatically allocated map, of course.
     536    ///If you don't use this function before calling \ref run(Node) "run()"
     537    ///or \ref init(), an instance will be allocated automatically.
     538    ///The destructor deallocates this automatically allocated map,
     539    ///of course.
    532540    ///\return <tt> (*this) </tt>
    533541    Dijkstra &processedMap(ProcessedMap &m)
     
    545553    ///Sets the map that stores the distances of the nodes calculated by the
    546554    ///algorithm.
    547     ///If you don't use this function before calling \ref run(),
    548     ///it will allocate one. The destructor deallocates this
    549     ///automatically allocated map, of course.
     555    ///If you don't use this function before calling \ref run(Node) "run()"
     556    ///or \ref init(), an instance will be allocated automatically.
     557    ///The destructor deallocates this automatically allocated map,
     558    ///of course.
    550559    ///\return <tt> (*this) </tt>
    551560    Dijkstra &distMap(DistMap &m)
     
    562571
    563572    ///Sets the heap and the cross reference used by algorithm.
    564     ///If you don't use this function before calling \ref run(),
    565     ///it will allocate one. The destructor deallocates this
    566     ///automatically allocated heap and cross reference, of course.
     573    ///If you don't use this function before calling \ref run(Node) "run()"
     574    ///or \ref init(), heap and cross reference instances will be
     575    ///allocated automatically.
     576    ///The destructor deallocates these automatically allocated objects,
     577    ///of course.
    567578    ///\return <tt> (*this) </tt>
    568579    Dijkstra &heap(Heap& hp, HeapCrossRef &cr)
     
    591602  public:
    592603
    593     ///\name Execution control
    594     ///The simplest way to execute the algorithm is to use one of the
    595     ///member functions called \ref lemon::Dijkstra::run() "run()".
    596     ///\n
    597     ///If you need more control on the execution, first you must call
    598     ///\ref lemon::Dijkstra::init() "init()", then you can add several
    599     ///source nodes with \ref lemon::Dijkstra::addSource() "addSource()".
    600     ///Finally \ref lemon::Dijkstra::start() "start()" will perform the
    601     ///actual path computation.
     604    ///\name Execution Control
     605    ///The simplest way to execute the %Dijkstra algorithm is to use
     606    ///one of the member functions called \ref run(Node) "run()".\n
     607    ///If you need more control on the execution, first you have to call
     608    ///\ref init(), then you can add several source nodes with
     609    ///\ref addSource(). Finally the actual path computation can be
     610    ///performed with one of the \ref start() functions.
    602611
    603612    ///@{
    604613
     614    ///\brief Initializes the internal data structures.
     615    ///
    605616    ///Initializes the internal data structures.
    606 
    607     ///Initializes the internal data structures.
    608     ///
    609617    void init()
    610618    {
     
    682690    }
    683691
    684     ///\brief Returns \c false if there are nodes
    685     ///to be processed.
    686     ///
    687     ///Returns \c false if there are nodes
    688     ///to be processed in the priority heap.
     692    ///Returns \c false if there are nodes to be processed.
     693
     694    ///Returns \c false if there are nodes to be processed
     695    ///in the priority heap.
    689696    bool emptyQueue() const { return _heap->empty(); }
    690697
    691     ///Returns the number of the nodes to be processed in the priority heap
    692 
    693     ///Returns the number of the nodes to be processed in the priority heap.
    694     ///
     698    ///Returns the number of the nodes to be processed.
     699
     700    ///Returns the number of the nodes to be processed
     701    ///in the priority heap.
    695702    int queueSize() const { return _heap->size(); }
    696703
     
    813820
    814821    ///\name Query Functions
    815     ///The result of the %Dijkstra algorithm can be obtained using these
     822    ///The results of the %Dijkstra algorithm can be obtained using these
    816823    ///functions.\n
    817     ///Either \ref lemon::Dijkstra::run() "run()" or
    818     ///\ref lemon::Dijkstra::start() "start()" must be called before
    819     ///using them.
     824    ///Either \ref run(Node) "run()" or \ref start() should be called
     825    ///before using them.
    820826
    821827    ///@{
     
    825831    ///Returns the shortest path to a node.
    826832    ///
    827     ///\warning \c t should be reachable from the root(s).
    828     ///
    829     ///\pre Either \ref run() or \ref start() must be called before
    830     ///using this function.
     833    ///\warning \c t should be reached from the root(s).
     834    ///
     835    ///\pre Either \ref run(Node) "run()" or \ref init()
     836    ///must be called before using this function.
    831837    Path path(Node t) const { return Path(*G, *_pred, t); }
    832838
     
    835841    ///Returns the distance of a node from the root(s).
    836842    ///
    837     ///\warning If node \c v is not reachable from the root(s), then
     843    ///\warning If node \c v is not reached from the root(s), then
    838844    ///the return value of this function is undefined.
    839845    ///
    840     ///\pre Either \ref run() or \ref start() must be called before
    841     ///using this function.
     846    ///\pre Either \ref run(Node) "run()" or \ref init()
     847    ///must be called before using this function.
    842848    Value dist(Node v) const { return (*_dist)[v]; }
    843849
     
    846852    ///This function returns the 'previous arc' of the shortest path
    847853    ///tree for the node \c v, i.e. it returns the last arc of a
    848     ///shortest path from the root(s) to \c v. It is \c INVALID if \c v
    849     ///is not reachable from the root(s) or if \c v is a root.
     854    ///shortest path from a root to \c v. It is \c INVALID if \c v
     855    ///is not reached from the root(s) or if \c v is a root.
    850856    ///
    851857    ///The shortest path tree used here is equal to the shortest path
    852858    ///tree used in \ref predNode().
    853859    ///
    854     ///\pre Either \ref run() or \ref start() must be called before
    855     ///using this function.
     860    ///\pre Either \ref run(Node) "run()" or \ref init()
     861    ///must be called before using this function.
    856862    Arc predArc(Node v) const { return (*_pred)[v]; }
    857863
     
    860866    ///This function returns the 'previous node' of the shortest path
    861867    ///tree for the node \c v, i.e. it returns the last but one node
    862     ///from a shortest path from the root(s) to \c v. It is \c INVALID
    863     ///if \c v is not reachable from the root(s) or if \c v is a root.
     868    ///from a shortest path from a root to \c v. It is \c INVALID
     869    ///if \c v is not reached from the root(s) or if \c v is a root.
    864870    ///
    865871    ///The shortest path tree used here is equal to the shortest path
    866872    ///tree used in \ref predArc().
    867873    ///
    868     ///\pre Either \ref run() or \ref start() must be called before
    869     ///using this function.
     874    ///\pre Either \ref run(Node) "run()" or \ref init()
     875    ///must be called before using this function.
    870876    Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
    871877                                  G->source((*_pred)[v]); }
     
    877883    ///of the nodes calculated by the algorithm.
    878884    ///
    879     ///\pre Either \ref run() or \ref init()
     885    ///\pre Either \ref run(Node) "run()" or \ref init()
    880886    ///must be called before using this function.
    881887    const DistMap &distMap() const { return *_dist;}
     
    887893    ///arcs, which form the shortest path tree.
    888894    ///
    889     ///\pre Either \ref run() or \ref init()
     895    ///\pre Either \ref run(Node) "run()" or \ref init()
    890896    ///must be called before using this function.
    891897    const PredMap &predMap() const { return *_pred;}
    892898
    893     ///Checks if a node is reachable from the root(s).
    894 
    895     ///Returns \c true if \c v is reachable from the root(s).
    896     ///\pre Either \ref run() or \ref start()
     899    ///Checks if a node is reached from the root(s).
     900
     901    ///Returns \c true if \c v is reached from the root(s).
     902    ///
     903    ///\pre Either \ref run(Node) "run()" or \ref init()
    897904    ///must be called before using this function.
    898905    bool reached(Node v) const { return (*_heap_cross_ref)[v] !=
     
    903910    ///Returns \c true if \c v is processed, i.e. the shortest
    904911    ///path to \c v has already found.
    905     ///\pre Either \ref run() or \ref init()
     912    ///
     913    ///\pre Either \ref run(Node) "run()" or \ref init()
    906914    ///must be called before using this function.
    907915    bool processed(Node v) const { return (*_heap_cross_ref)[v] ==
     
    912920    ///Returns the current distance of a node from the root(s).
    913921    ///It may be decreased in the following processes.
    914     ///\pre Either \ref run() or \ref init()
     922    ///
     923    ///\pre Either \ref run(Node) "run()" or \ref init()
    915924    ///must be called before using this function and
    916925    ///node \c v must be reached but not necessarily processed.
     
    10951104  /// This auxiliary class is created to implement the
    10961105  /// \ref dijkstra() "function-type interface" of \ref Dijkstra algorithm.
    1097   /// It does not have own \ref run() method, it uses the functions
    1098   /// and features of the plain \ref Dijkstra.
     1106  /// It does not have own \ref run(Node) "run()" method, it uses the
     1107  /// functions and features of the plain \ref Dijkstra.
    10991108  ///
    11001109  /// This class should only be used through the \ref dijkstra() function,
     
    12911300  ///  bool reached = dijkstra(g,length).path(p).dist(d).run(s,t);
    12921301  ///\endcode
    1293   ///\warning Don't forget to put the \ref DijkstraWizard::run() "run()"
     1302  ///\warning Don't forget to put the \ref DijkstraWizard::run(Node) "run()"
    12941303  ///to the end of the parameter list.
    12951304  ///\sa DijkstraWizard
Note: See TracChangeset for help on using the changeset viewer.