COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bfs.h

    r492 r788  
    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.
     
    226227    ///\ref named-templ-param "Named parameter" for setting
    227228    ///\c PredMap type.
    228     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     229    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    229230    template <class T>
    230231    struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
     
    246247    ///\ref named-templ-param "Named parameter" for setting
    247248    ///\c DistMap type.
    248     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     249    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    249250    template <class T>
    250251    struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
     
    266267    ///\ref named-templ-param "Named parameter" for setting
    267268    ///\c ReachedMap type.
    268     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     269    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    269270    template <class T>
    270271    struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
     
    286287    ///\ref named-templ-param "Named parameter" for setting
    287288    ///\c ProcessedMap type.
    288     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     289    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    289290    template <class T>
    290291    struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
     
    414415    ///The simplest way to execute the BFS algorithm is to use one of the
    415416    ///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
     417    ///If you need better control on the execution, you have to call
     418    ///\ref init() first, then you can add several source nodes with
    418419    ///\ref addSource(). Finally the actual path computation can be
    419420    ///performed with one of the \ref start() functions.
     
    701702    ///Runs the algorithm to visit all nodes in the digraph.
    702703
    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).
     704    ///This method runs the %BFS algorithm in order to visit all nodes
     705    ///in the digraph.
    709706    ///
    710707    ///\note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    738735    ///@{
    739736
    740     ///The shortest path to a node.
    741 
    742     ///Returns the shortest path to a node.
     737    ///The shortest path to the given node.
     738
     739    ///Returns the shortest path to the given node from the root(s).
    743740    ///
    744741    ///\warning \c t should be reached from the root(s).
     
    748745    Path path(Node t) const { return Path(*G, *_pred, t); }
    749746
    750     ///The distance of a node from the root(s).
    751 
    752     ///Returns the distance of a node from the root(s).
     747    ///The distance of the given node from the root(s).
     748
     749    ///Returns the distance of the given node from the root(s).
    753750    ///
    754751    ///\warning If node \c v is not reached from the root(s), then
     
    759756    int dist(Node v) const { return (*_dist)[v]; }
    760757
    761     ///Returns the 'previous arc' of the shortest path tree for a node.
    762 
     758    ///\brief Returns the 'previous arc' of the shortest path tree for
     759    ///the given node.
     760    ///
    763761    ///This function returns the 'previous arc' of the shortest path
    764762    ///tree for the node \c v, i.e. it returns the last arc of a
     
    767765    ///
    768766    ///The shortest path tree used here is equal to the shortest path
    769     ///tree used in \ref predNode().
     767    ///tree used in \ref predNode() and \ref predMap().
    770768    ///
    771769    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    773771    Arc predArc(Node v) const { return (*_pred)[v];}
    774772
    775     ///Returns the 'previous node' of the shortest path tree for a node.
    776 
     773    ///\brief Returns the 'previous node' of the shortest path tree for
     774    ///the given node.
     775    ///
    777776    ///This function returns the 'previous node' of the shortest path
    778777    ///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
     778    ///of a shortest path from a root to \c v. It is \c INVALID
    780779    ///if \c v is not reached from the root(s) or if \c v is a root.
    781780    ///
    782781    ///The shortest path tree used here is equal to the shortest path
    783     ///tree used in \ref predArc().
     782    ///tree used in \ref predArc() and \ref predMap().
    784783    ///
    785784    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    802801    ///
    803802    ///Returns a const reference to the node map that stores the predecessor
    804     ///arcs, which form the shortest path tree.
     803    ///arcs, which form the shortest path tree (forest).
    805804    ///
    806805    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    808807    const PredMap &predMap() const { return *_pred;}
    809808
    810     ///Checks if a node is reached from the root(s).
     809    ///Checks if the given node is reached from the root(s).
    811810
    812811    ///Returns \c true if \c v is reached from the root(s).
     
    834833    ///The type of the map that stores the predecessor
    835834    ///arcs of the shortest paths.
    836     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     835    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    837836    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    838837    ///Instantiates a PredMap.
     
    849848
    850849    ///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.
     850    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     851    ///By default, it is a NullMap.
    853852    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    854853    ///Instantiates a ProcessedMap.
     
    869868
    870869    ///The type of the map that indicates which nodes are reached.
    871     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     870    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    872871    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    873872    ///Instantiates a ReachedMap.
     
    884883
    885884    ///The type of the map that stores the distances of the nodes.
    886     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     885    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    887886    typedef typename Digraph::template NodeMap<int> DistMap;
    888887    ///Instantiates a DistMap.
     
    899898
    900899    ///The type of the shortest paths.
    901     ///It must meet the \ref concepts::Path "Path" concept.
     900    ///It must conform to the \ref concepts::Path "Path" concept.
    902901    typedef lemon::Path<Digraph> Path;
    903902  };
     
    905904  /// Default traits class used by BfsWizard
    906905
    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.
     906  /// Default traits class used by BfsWizard.
     907  /// \tparam GR The type of the digraph.
    913908  template<class GR>
    914909  class BfsWizardBase : public BfsWizardDefaultTraits<GR>
     
    938933    /// Constructor.
    939934
    940     /// This constructor does not require parameters, therefore it initiates
     935    /// This constructor does not require parameters, it initiates
    941936    /// all of the attributes to \c 0.
    942937    BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
     
    968963    typedef TR Base;
    969964
    970     ///The type of the digraph the algorithm runs on.
    971965    typedef typename TR::Digraph Digraph;
    972966
     
    976970    typedef typename Digraph::OutArcIt OutArcIt;
    977971
    978     ///\brief The type of the map that stores the predecessor
    979     ///arcs of the shortest paths.
    980972    typedef typename TR::PredMap PredMap;
    981     ///\brief The type of the map that stores the distances of the nodes.
    982973    typedef typename TR::DistMap DistMap;
    983     ///\brief The type of the map that indicates which nodes are reached.
    984974    typedef typename TR::ReachedMap ReachedMap;
    985     ///\brief The type of the map that indicates which nodes are processed.
    986975    typedef typename TR::ProcessedMap ProcessedMap;
    987     ///The type of the shortest paths
    988976    typedef typename TR::Path Path;
    989977
     
    10551043    ///Runs BFS algorithm to visit all nodes in the digraph.
    10561044
    1057     ///This method runs BFS algorithm in order to compute
    1058     ///the shortest path to each node.
     1045    ///This method runs BFS algorithm in order to visit all nodes
     1046    ///in the digraph.
    10591047    void run()
    10601048    {
     
    10681056      SetPredMapBase(const TR &b) : TR(b) {}
    10691057    };
    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.
     1058
     1059    ///\brief \ref named-templ-param "Named parameter" for setting
     1060    ///the predecessor map.
     1061    ///
     1062    ///\ref named-templ-param "Named parameter" function for setting
     1063    ///the map that stores the predecessor arcs of the nodes.
    10751064    template<class T>
    10761065    BfsWizard<SetPredMapBase<T> > predMap(const T &t)
     
    10861075      SetReachedMapBase(const TR &b) : TR(b) {}
    10871076    };
    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.
     1077
     1078    ///\brief \ref named-templ-param "Named parameter" for setting
     1079    ///the reached map.
     1080    ///
     1081    ///\ref named-templ-param "Named parameter" function for setting
     1082    ///the map that indicates which nodes are reached.
    10931083    template<class T>
    10941084    BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     
    11041094      SetDistMapBase(const TR &b) : TR(b) {}
    11051095    };
    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.
     1096
     1097    ///\brief \ref named-templ-param "Named parameter" for setting
     1098    ///the distance map.
     1099    ///
     1100    ///\ref named-templ-param "Named parameter" function for setting
     1101    ///the map that stores the distances of the nodes calculated
     1102    ///by the algorithm.
    11111103    template<class T>
    11121104    BfsWizard<SetDistMapBase<T> > distMap(const T &t)
     
    11221114      SetProcessedMapBase(const TR &b) : TR(b) {}
    11231115    };
    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.
     1116
     1117    ///\brief \ref named-func-param "Named parameter" for setting
     1118    ///the processed map.
     1119    ///
     1120    ///\ref named-templ-param "Named parameter" function for setting
     1121    ///the map that indicates which nodes are processed.
    11291122    template<class T>
    11301123    BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     
    12651258    ///
    12661259    /// The type of the map that indicates which nodes are reached.
    1267     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     1260    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    12681261    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    12691262
     
    14261419    /// The simplest way to execute the BFS algorithm is to use one of the
    14271420    /// 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
     1421    /// If you need better control on the execution, you have to call
     1422    /// \ref init() first, then you can add several source nodes with
    14301423    /// \ref addSource(). Finally the actual path computation can be
    14311424    /// performed with one of the \ref start() functions.
     
    16991692    /// \brief Runs the algorithm to visit all nodes in the digraph.
    17001693    ///
    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).
     1694    /// This method runs the %BFS algorithm in order to visit all nodes
     1695    /// in the digraph.
    17071696    ///
    17081697    /// \note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    17361725    ///@{
    17371726
    1738     /// \brief Checks if a node is reached from the root(s).
     1727    /// \brief Checks if the given node is reached from the root(s).
    17391728    ///
    17401729    /// Returns \c true if \c v is reached from the root(s).
Note: See TracChangeset for help on using the changeset viewer.