COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bfs.h

    r525 r891  
    4848    ///The type of the map that stores the predecessor
    4949    ///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.
    5151    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    5252    ///Instantiates a \c PredMap.
     
    6363
    6464    ///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    ///By default, it is a NullMap.
    6667    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    6768    ///Instantiates a \c ProcessedMap.
     
    8283
    8384    ///The type of the map that indicates which nodes are reached.
    84     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     85    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    8586    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    8687    ///Instantiates a \c ReachedMap.
     
    9798
    9899    ///The type of the map that stores the distances of the nodes.
    99     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     100    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    100101    typedef typename Digraph::template NodeMap<int> DistMap;
    101102    ///Instantiates a \c DistMap.
     
    121122  ///\tparam GR The type of the digraph the algorithm runs on.
    122123  ///The default type is \ref ListDigraph.
     124  ///\tparam TR The traits class that defines various types used by the
     125  ///algorithm. By default, it is \ref BfsDefaultTraits
     126  ///"BfsDefaultTraits<GR>".
     127  ///In most cases, this parameter should not be set directly,
     128  ///consider to use the named template parameters instead.
    123129#ifdef DOXYGEN
    124130  template <typename GR,
     
    226232    ///\ref named-templ-param "Named parameter" for setting
    227233    ///\c PredMap type.
    228     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     234    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    229235    template <class T>
    230236    struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
     
    246252    ///\ref named-templ-param "Named parameter" for setting
    247253    ///\c DistMap type.
    248     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     254    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    249255    template <class T>
    250256    struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
     
    266272    ///\ref named-templ-param "Named parameter" for setting
    267273    ///\c ReachedMap type.
    268     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     274    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    269275    template <class T>
    270276    struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
     
    286292    ///\ref named-templ-param "Named parameter" for setting
    287293    ///\c ProcessedMap type.
    288     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     294    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    289295    template <class T>
    290296    struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
     
    414420    ///The simplest way to execute the BFS algorithm is to use one of the
    415421    ///member functions called \ref run(Node) "run()".\n
    416     ///If you need more control on the execution, first you have to call
    417     ///\ref init(), then you can add several source nodes with
     422    ///If you need better control on the execution, you have to call
     423    ///\ref init() first, then you can add several source nodes with
    418424    ///\ref addSource(). Finally the actual path computation can be
    419425    ///performed with one of the \ref start() functions.
     
    701707    ///Runs the algorithm to visit all nodes in the digraph.
    702708
    703     ///This method runs the %BFS algorithm in order to
    704     ///compute the shortest path to each node.
    705     ///
    706     ///The algorithm computes
    707     ///- the shortest path tree (forest),
    708     ///- the distance of each node from the root(s).
     709    ///This method runs the %BFS algorithm in order to visit all nodes
     710    ///in the digraph.
    709711    ///
    710712    ///\note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    738740    ///@{
    739741
    740     ///The shortest path to a node.
    741 
    742     ///Returns the shortest path to a node.
     742    ///The shortest path to the given node.
     743
     744    ///Returns the shortest path to the given node from the root(s).
    743745    ///
    744746    ///\warning \c t should be reached from the root(s).
     
    748750    Path path(Node t) const { return Path(*G, *_pred, t); }
    749751
    750     ///The distance of a node from the root(s).
    751 
    752     ///Returns the distance of a node from the root(s).
     752    ///The distance of the given node from the root(s).
     753
     754    ///Returns the distance of the given node from the root(s).
    753755    ///
    754756    ///\warning If node \c v is not reached from the root(s), then
     
    759761    int dist(Node v) const { return (*_dist)[v]; }
    760762
    761     ///Returns the 'previous arc' of the shortest path tree for a node.
    762 
     763    ///\brief Returns the 'previous arc' of the shortest path tree for
     764    ///the given node.
     765    ///
    763766    ///This function returns the 'previous arc' of the shortest path
    764767    ///tree for the node \c v, i.e. it returns the last arc of a
     
    767770    ///
    768771    ///The shortest path tree used here is equal to the shortest path
    769     ///tree used in \ref predNode().
     772    ///tree used in \ref predNode() and \ref predMap().
    770773    ///
    771774    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    773776    Arc predArc(Node v) const { return (*_pred)[v];}
    774777
    775     ///Returns the 'previous node' of the shortest path tree for a node.
    776 
     778    ///\brief Returns the 'previous node' of the shortest path tree for
     779    ///the given node.
     780    ///
    777781    ///This function returns the 'previous node' of the shortest path
    778782    ///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
     783    ///of a shortest path from a root to \c v. It is \c INVALID
    780784    ///if \c v is not reached from the root(s) or if \c v is a root.
    781785    ///
    782786    ///The shortest path tree used here is equal to the shortest path
    783     ///tree used in \ref predArc().
     787    ///tree used in \ref predArc() and \ref predMap().
    784788    ///
    785789    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    802806    ///
    803807    ///Returns a const reference to the node map that stores the predecessor
    804     ///arcs, which form the shortest path tree.
     808    ///arcs, which form the shortest path tree (forest).
    805809    ///
    806810    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    808812    const PredMap &predMap() const { return *_pred;}
    809813
    810     ///Checks if a node is reached from the root(s).
     814    ///Checks if the given node is reached from the root(s).
    811815
    812816    ///Returns \c true if \c v is reached from the root(s).
     
    834838    ///The type of the map that stores the predecessor
    835839    ///arcs of the shortest paths.
    836     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     840    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    837841    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    838842    ///Instantiates a PredMap.
     
    849853
    850854    ///The type of the map that indicates which nodes are processed.
    851     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    852     ///By default it is a NullMap.
     855    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     856    ///By default, it is a NullMap.
    853857    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    854858    ///Instantiates a ProcessedMap.
     
    869873
    870874    ///The type of the map that indicates which nodes are reached.
    871     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     875    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    872876    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    873877    ///Instantiates a ReachedMap.
     
    884888
    885889    ///The type of the map that stores the distances of the nodes.
    886     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     890    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    887891    typedef typename Digraph::template NodeMap<int> DistMap;
    888892    ///Instantiates a DistMap.
     
    899903
    900904    ///The type of the shortest paths.
    901     ///It must meet the \ref concepts::Path "Path" concept.
     905    ///It must conform to the \ref concepts::Path "Path" concept.
    902906    typedef lemon::Path<Digraph> Path;
    903907  };
     
    905909  /// Default traits class used by BfsWizard
    906910
    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.
     911  /// Default traits class used by BfsWizard.
     912  /// \tparam GR The type of the digraph.
    913913  template<class GR>
    914914  class BfsWizardBase : public BfsWizardDefaultTraits<GR>
     
    938938    /// Constructor.
    939939
    940     /// This constructor does not require parameters, therefore it initiates
     940    /// This constructor does not require parameters, it initiates
    941941    /// all of the attributes to \c 0.
    942942    BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
     
    963963  /// This class should only be used through the \ref bfs() function,
    964964  /// which makes it easier to use the algorithm.
     965  ///
     966  /// \tparam TR The traits class that defines various types used by the
     967  /// algorithm.
    965968  template<class TR>
    966969  class BfsWizard : public TR
     
    968971    typedef TR Base;
    969972
    970     ///The type of the digraph the algorithm runs on.
    971973    typedef typename TR::Digraph Digraph;
    972974
     
    976978    typedef typename Digraph::OutArcIt OutArcIt;
    977979
    978     ///\brief The type of the map that stores the predecessor
    979     ///arcs of the shortest paths.
    980980    typedef typename TR::PredMap PredMap;
    981     ///\brief The type of the map that stores the distances of the nodes.
    982981    typedef typename TR::DistMap DistMap;
    983     ///\brief The type of the map that indicates which nodes are reached.
    984982    typedef typename TR::ReachedMap ReachedMap;
    985     ///\brief The type of the map that indicates which nodes are processed.
    986983    typedef typename TR::ProcessedMap ProcessedMap;
    987     ///The type of the shortest paths
    988984    typedef typename TR::Path Path;
    989985
     
    10551051    ///Runs BFS algorithm to visit all nodes in the digraph.
    10561052
    1057     ///This method runs BFS algorithm in order to compute
    1058     ///the shortest path to each node.
     1053    ///This method runs BFS algorithm in order to visit all nodes
     1054    ///in the digraph.
    10591055    void run()
    10601056    {
     
    10681064      SetPredMapBase(const TR &b) : TR(b) {}
    10691065    };
    1070     ///\brief \ref named-func-param "Named parameter"
    1071     ///for setting PredMap object.
    1072     ///
    1073     ///\ref named-func-param "Named parameter"
    1074     ///for setting PredMap object.
     1066
     1067    ///\brief \ref named-templ-param "Named parameter" for setting
     1068    ///the predecessor map.
     1069    ///
     1070    ///\ref named-templ-param "Named parameter" function for setting
     1071    ///the map that stores the predecessor arcs of the nodes.
    10751072    template<class T>
    10761073    BfsWizard<SetPredMapBase<T> > predMap(const T &t)
     
    10861083      SetReachedMapBase(const TR &b) : TR(b) {}
    10871084    };
    1088     ///\brief \ref named-func-param "Named parameter"
    1089     ///for setting ReachedMap object.
    1090     ///
    1091     /// \ref named-func-param "Named parameter"
    1092     ///for setting ReachedMap object.
     1085
     1086    ///\brief \ref named-templ-param "Named parameter" for setting
     1087    ///the reached map.
     1088    ///
     1089    ///\ref named-templ-param "Named parameter" function for setting
     1090    ///the map that indicates which nodes are reached.
    10931091    template<class T>
    10941092    BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     
    11041102      SetDistMapBase(const TR &b) : TR(b) {}
    11051103    };
    1106     ///\brief \ref named-func-param "Named parameter"
    1107     ///for setting DistMap object.
    1108     ///
    1109     /// \ref named-func-param "Named parameter"
    1110     ///for setting DistMap object.
     1104
     1105    ///\brief \ref named-templ-param "Named parameter" for setting
     1106    ///the distance map.
     1107    ///
     1108    ///\ref named-templ-param "Named parameter" function for setting
     1109    ///the map that stores the distances of the nodes calculated
     1110    ///by the algorithm.
    11111111    template<class T>
    11121112    BfsWizard<SetDistMapBase<T> > distMap(const T &t)
     
    11221122      SetProcessedMapBase(const TR &b) : TR(b) {}
    11231123    };
    1124     ///\brief \ref named-func-param "Named parameter"
    1125     ///for setting ProcessedMap object.
    1126     ///
    1127     /// \ref named-func-param "Named parameter"
    1128     ///for setting ProcessedMap object.
     1124
     1125    ///\brief \ref named-func-param "Named parameter" for setting
     1126    ///the processed map.
     1127    ///
     1128    ///\ref named-templ-param "Named parameter" function for setting
     1129    ///the map that indicates which nodes are processed.
    11291130    template<class T>
    11301131    BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     
    12651266    ///
    12661267    /// The type of the map that indicates which nodes are reached.
    1267     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     1268    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    12681269    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    12691270
     
    13031304  /// does not observe the BFS events. If you want to observe the BFS
    13041305  /// events, you should implement your own visitor class.
    1305   /// \tparam TR Traits class to set various data types used by the
    1306   /// algorithm. The default traits class is
    1307   /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>".
    1308   /// See \ref BfsVisitDefaultTraits for the documentation of
    1309   /// a BFS visit traits class.
     1306  /// \tparam TR The traits class that defines various types used by the
     1307  /// algorithm. By default, it is \ref BfsVisitDefaultTraits
     1308  /// "BfsVisitDefaultTraits<GR>".
     1309  /// In most cases, this parameter should not be set directly,
     1310  /// consider to use the named template parameters instead.
    13101311#ifdef DOXYGEN
    13111312  template <typename GR, typename VS, typename TR>
     
    14261427    /// The simplest way to execute the BFS algorithm is to use one of the
    14271428    /// member functions called \ref run(Node) "run()".\n
    1428     /// If you need more control on the execution, first you have to call
    1429     /// \ref init(), then you can add several source nodes with
     1429    /// If you need better control on the execution, you have to call
     1430    /// \ref init() first, then you can add several source nodes with
    14301431    /// \ref addSource(). Finally the actual path computation can be
    14311432    /// performed with one of the \ref start() functions.
     
    16991700    /// \brief Runs the algorithm to visit all nodes in the digraph.
    17001701    ///
    1701     /// This method runs the %BFS algorithm in order to
    1702     /// compute the shortest path to each node.
    1703     ///
    1704     /// The algorithm computes
    1705     /// - the shortest path tree (forest),
    1706     /// - the distance of each node from the root(s).
     1702    /// This method runs the %BFS algorithm in order to visit all nodes
     1703    /// in the digraph.
    17071704    ///
    17081705    /// \note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    17361733    ///@{
    17371734
    1738     /// \brief Checks if a node is reached from the root(s).
     1735    /// \brief Checks if the given node is reached from the root(s).
    17391736    ///
    17401737    /// Returns \c true if \c v is reached from the root(s).
Note: See TracChangeset for help on using the changeset viewer.