COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dfs.h

    r584 r788  
    4848    ///The type of the map that stores the predecessor
    4949    ///arcs of the %DFS 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.
     
    225226    ///\ref named-templ-param "Named parameter" for setting
    226227    ///\c PredMap type.
    227     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     228    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    228229    template <class T>
    229230    struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
     
    245246    ///\ref named-templ-param "Named parameter" for setting
    246247    ///\c DistMap type.
    247     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     248    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    248249    template <class T>
    249250    struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > {
     
    265266    ///\ref named-templ-param "Named parameter" for setting
    266267    ///\c ReachedMap type.
    267     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     268    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    268269    template <class T>
    269270    struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > {
     
    285286    ///\ref named-templ-param "Named parameter" for setting
    286287    ///\c ProcessedMap type.
    287     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     288    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    288289    template <class T>
    289290    struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > {
     
    412413    ///The simplest way to execute the DFS algorithm is to use one of the
    413414    ///member functions called \ref run(Node) "run()".\n
    414     ///If you need more control on the execution, first you have to call
    415     ///\ref init(), then you can add a source node with \ref addSource()
     415    ///If you need better control on the execution, you have to call
     416    ///\ref init() first, then you can add a source node with \ref addSource()
    416417    ///and perform the actual computation with \ref start().
    417418    ///This procedure can be repeated if there are nodes that have not
     
    633634    ///Runs the algorithm to visit all nodes in the digraph.
    634635
    635     ///This method runs the %DFS algorithm in order to compute the
    636     ///%DFS path to each node.
    637     ///
    638     ///The algorithm computes
    639     ///- the %DFS tree (forest),
    640     ///- the distance of each node from the root(s) in the %DFS tree.
     636    ///This method runs the %DFS algorithm in order to visit all nodes
     637    ///in the digraph.
    641638    ///
    642639    ///\note <tt>d.run()</tt> is just a shortcut of the following code.
     
    670667    ///@{
    671668
    672     ///The DFS path to a node.
    673 
    674     ///Returns the DFS path to a node.
     669    ///The DFS path to the given node.
     670
     671    ///Returns the DFS path to the given node from the root(s).
    675672    ///
    676673    ///\warning \c t should be reached from the root(s).
     
    680677    Path path(Node t) const { return Path(*G, *_pred, t); }
    681678
    682     ///The distance of a node from the root(s).
    683 
    684     ///Returns the distance of a node from the root(s).
     679    ///The distance of the given node from the root(s).
     680
     681    ///Returns the distance of the given node from the root(s).
    685682    ///
    686683    ///\warning If node \c v is not reached from the root(s), then
     
    691688    int dist(Node v) const { return (*_dist)[v]; }
    692689
    693     ///Returns the 'previous arc' of the %DFS tree for a node.
     690    ///Returns the 'previous arc' of the %DFS tree for the given node.
    694691
    695692    ///This function returns the 'previous arc' of the %DFS tree for the
     
    699696    ///
    700697    ///The %DFS tree used here is equal to the %DFS tree used in
    701     ///\ref predNode().
     698    ///\ref predNode() and \ref predMap().
    702699    ///
    703700    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    705702    Arc predArc(Node v) const { return (*_pred)[v];}
    706703
    707     ///Returns the 'previous node' of the %DFS tree.
     704    ///Returns the 'previous node' of the %DFS tree for the given node.
    708705
    709706    ///This function returns the 'previous node' of the %DFS
    710707    ///tree for the node \c v, i.e. it returns the last but one node
    711     ///from a %DFS path from a root to \c v. It is \c INVALID
     708    ///of a %DFS path from a root to \c v. It is \c INVALID
    712709    ///if \c v is not reached from the root(s) or if \c v is a root.
    713710    ///
    714711    ///The %DFS tree used here is equal to the %DFS tree used in
    715     ///\ref predArc().
     712    ///\ref predArc() and \ref predMap().
    716713    ///
    717714    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    734731    ///
    735732    ///Returns a const reference to the node map that stores the predecessor
    736     ///arcs, which form the DFS tree.
     733    ///arcs, which form the DFS tree (forest).
    737734    ///
    738735    ///\pre Either \ref run(Node) "run()" or \ref init()
     
    740737    const PredMap &predMap() const { return *_pred;}
    741738
    742     ///Checks if a node is reached from the root(s).
     739    ///Checks if the given node. node is reached from the root(s).
    743740
    744741    ///Returns \c true if \c v is reached from the root(s).
     
    766763    ///The type of the map that stores the predecessor
    767764    ///arcs of the %DFS paths.
    768     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     765    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    769766    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    770767    ///Instantiates a PredMap.
     
    781778
    782779    ///The type of the map that indicates which nodes are processed.
    783     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    784     ///By default it is a NullMap.
     780    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     781    ///By default, it is a NullMap.
    785782    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    786783    ///Instantiates a ProcessedMap.
     
    801798
    802799    ///The type of the map that indicates which nodes are reached.
    803     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     800    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    804801    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    805802    ///Instantiates a ReachedMap.
     
    816813
    817814    ///The type of the map that stores the distances of the nodes.
    818     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     815    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    819816    typedef typename Digraph::template NodeMap<int> DistMap;
    820817    ///Instantiates a DistMap.
     
    831828
    832829    ///The type of the DFS paths.
    833     ///It must meet the \ref concepts::Path "Path" concept.
     830    ///It must conform to the \ref concepts::Path "Path" concept.
    834831    typedef lemon::Path<Digraph> Path;
    835832  };
     
    837834  /// Default traits class used by DfsWizard
    838835
    839   /// To make it easier to use Dfs algorithm
    840   /// we have created a wizard class.
    841   /// This \ref DfsWizard class needs default traits,
    842   /// as well as the \ref Dfs class.
    843   /// The \ref DfsWizardBase is a class to be the default traits of the
    844   /// \ref DfsWizard class.
     836  /// Default traits class used by DfsWizard.
     837  /// \tparam GR The type of the digraph.
    845838  template<class GR>
    846839  class DfsWizardBase : public DfsWizardDefaultTraits<GR>
     
    870863    /// Constructor.
    871864
    872     /// This constructor does not require parameters, therefore it initiates
     865    /// This constructor does not require parameters, it initiates
    873866    /// all of the attributes to \c 0.
    874867    DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
     
    900893    typedef TR Base;
    901894
    902     ///The type of the digraph the algorithm runs on.
    903895    typedef typename TR::Digraph Digraph;
    904896
     
    908900    typedef typename Digraph::OutArcIt OutArcIt;
    909901
    910     ///\brief The type of the map that stores the predecessor
    911     ///arcs of the DFS paths.
    912902    typedef typename TR::PredMap PredMap;
    913     ///\brief The type of the map that stores the distances of the nodes.
    914903    typedef typename TR::DistMap DistMap;
    915     ///\brief The type of the map that indicates which nodes are reached.
    916904    typedef typename TR::ReachedMap ReachedMap;
    917     ///\brief The type of the map that indicates which nodes are processed.
    918905    typedef typename TR::ProcessedMap ProcessedMap;
    919     ///The type of the DFS paths
    920906    typedef typename TR::Path Path;
    921907
     
    987973    ///Runs DFS algorithm to visit all nodes in the digraph.
    988974
    989     ///This method runs DFS algorithm in order to compute
    990     ///the DFS path to each node.
     975    ///This method runs DFS algorithm in order to visit all nodes
     976    ///in the digraph.
    991977    void run()
    992978    {
     
    1000986      SetPredMapBase(const TR &b) : TR(b) {}
    1001987    };
    1002     ///\brief \ref named-func-param "Named parameter"
    1003     ///for setting PredMap object.
    1004     ///
    1005     ///\ref named-func-param "Named parameter"
    1006     ///for setting PredMap object.
     988
     989    ///\brief \ref named-templ-param "Named parameter" for setting
     990    ///the predecessor map.
     991    ///
     992    ///\ref named-templ-param "Named parameter" function for setting
     993    ///the map that stores the predecessor arcs of the nodes.
    1007994    template<class T>
    1008995    DfsWizard<SetPredMapBase<T> > predMap(const T &t)
     
    10181005      SetReachedMapBase(const TR &b) : TR(b) {}
    10191006    };
    1020     ///\brief \ref named-func-param "Named parameter"
    1021     ///for setting ReachedMap object.
    1022     ///
    1023     /// \ref named-func-param "Named parameter"
    1024     ///for setting ReachedMap object.
     1007
     1008    ///\brief \ref named-templ-param "Named parameter" for setting
     1009    ///the reached map.
     1010    ///
     1011    ///\ref named-templ-param "Named parameter" function for setting
     1012    ///the map that indicates which nodes are reached.
    10251013    template<class T>
    10261014    DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     
    10361024      SetDistMapBase(const TR &b) : TR(b) {}
    10371025    };
    1038     ///\brief \ref named-func-param "Named parameter"
    1039     ///for setting DistMap object.
    1040     ///
    1041     /// \ref named-func-param "Named parameter"
    1042     ///for setting DistMap object.
     1026
     1027    ///\brief \ref named-templ-param "Named parameter" for setting
     1028    ///the distance map.
     1029    ///
     1030    ///\ref named-templ-param "Named parameter" function for setting
     1031    ///the map that stores the distances of the nodes calculated
     1032    ///by the algorithm.
    10431033    template<class T>
    10441034    DfsWizard<SetDistMapBase<T> > distMap(const T &t)
     
    10541044      SetProcessedMapBase(const TR &b) : TR(b) {}
    10551045    };
    1056     ///\brief \ref named-func-param "Named parameter"
    1057     ///for setting ProcessedMap object.
    1058     ///
    1059     /// \ref named-func-param "Named parameter"
    1060     ///for setting ProcessedMap object.
     1046
     1047    ///\brief \ref named-func-param "Named parameter" for setting
     1048    ///the processed map.
     1049    ///
     1050    ///\ref named-templ-param "Named parameter" function for setting
     1051    ///the map that indicates which nodes are processed.
    10611052    template<class T>
    10621053    DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     
    12091200    ///
    12101201    /// The type of the map that indicates which nodes are reached.
    1211     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     1202    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    12121203    typedef typename Digraph::template NodeMap<bool> ReachedMap;
    12131204
     
    13701361    /// The simplest way to execute the DFS algorithm is to use one of the
    13711362    /// member functions called \ref run(Node) "run()".\n
    1372     /// If you need more control on the execution, first you have to call
    1373     /// \ref init(), then you can add a source node with \ref addSource()
     1363    /// If you need better control on the execution, you have to call
     1364    /// \ref init() first, then you can add a source node with \ref addSource()
    13741365    /// and perform the actual computation with \ref start().
    13751366    /// This procedure can be repeated if there are nodes that have not
     
    15841575    /// \brief Runs the algorithm to visit all nodes in the digraph.
    15851576
    1586     /// This method runs the %DFS algorithm in order to
    1587     /// compute the %DFS path to each node.
    1588     ///
    1589     /// The algorithm computes
    1590     /// - the %DFS tree (forest),
    1591     /// - the distance of each node from the root(s) in the %DFS tree.
     1577    /// This method runs the %DFS algorithm in order to visit all nodes
     1578    /// in the digraph.
    15921579    ///
    15931580    /// \note <tt>d.run()</tt> is just a shortcut of the following code.
     
    16211608    ///@{
    16221609
    1623     /// \brief Checks if a node is reached from the root(s).
     1610    /// \brief Checks if the given node is reached from the root(s).
    16241611    ///
    16251612    /// Returns \c true if \c v is reached from the root(s).
Note: See TracChangeset for help on using the changeset viewer.