lemon/dag_shortest_path.h
changeset 1946 17eb3eaad9f8
parent 1912 d9205a711324
child 1956 a055123339d5
equal deleted inserted replaced
0:d7fa3001e425 1:eae639e31ebb
   114     typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
   114     typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
   115 
   115 
   116     /// \brief Instantiates a PredMap.
   116     /// \brief Instantiates a PredMap.
   117     /// 
   117     /// 
   118     /// This function instantiates a \ref PredMap. 
   118     /// This function instantiates a \ref PredMap. 
   119     /// \param G is the graph, to which we would like to define the PredMap.
   119     /// \param graph is the graph, to which we would
       
   120     /// like to define the PredMap.
   120     /// \todo The graph alone may be insufficient for the initialization
   121     /// \todo The graph alone may be insufficient for the initialization
   121     static PredMap *createPredMap(const _Graph& graph) {
   122     static PredMap *createPredMap(const _Graph& graph) {
   122       return new PredMap(graph);
   123       return new PredMap(graph);
   123     }
   124     }
   124 
   125 
   131     DistMap;
   132     DistMap;
   132 
   133 
   133     /// \brief Instantiates a DistMap.
   134     /// \brief Instantiates a DistMap.
   134     ///
   135     ///
   135     /// This function instantiates a \ref DistMap. 
   136     /// This function instantiates a \ref DistMap. 
   136     /// \param G is the graph, to which we would like to define the 
   137     /// \param graph is the graph, to which we would like to define the 
   137     /// \ref DistMap
   138     /// \ref DistMap
   138     static DistMap *createDistMap(const _Graph& graph) {
   139     static DistMap *createDistMap(const _Graph& graph) {
   139       return new DistMap(graph);
   140       return new DistMap(graph);
   140     }
   141     }
   141 
   142 
   225     typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
   226     typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
   226 
   227 
   227     /// \brief Instantiates a PredMap.
   228     /// \brief Instantiates a PredMap.
   228     /// 
   229     /// 
   229     /// This function instantiates a \ref PredMap. 
   230     /// This function instantiates a \ref PredMap. 
   230     /// \param G is the graph, to which we would like to define the PredMap.
   231     /// \param graph is the graph,
       
   232     /// to which we would like to define the PredMap.
   231     /// \todo The graph alone may be insufficient for the initialization
   233     /// \todo The graph alone may be insufficient for the initialization
   232     static PredMap *createPredMap(const _Graph& graph) {
   234     static PredMap *createPredMap(const _Graph& graph) {
   233       return new PredMap(graph);
   235       return new PredMap(graph);
   234     }
   236     }
   235 
   237 
   242     DistMap;
   244     DistMap;
   243 
   245 
   244     /// \brief Instantiates a DistMap.
   246     /// \brief Instantiates a DistMap.
   245     ///
   247     ///
   246     /// This function instantiates a \ref DistMap. 
   248     /// This function instantiates a \ref DistMap. 
   247     /// \param G is the graph, to which we would like to define the 
   249     /// \param graph is the graph, to which we would like to define the 
   248     /// \ref DistMap
   250     /// \ref DistMap
   249     static DistMap *createDistMap(const _Graph& graph) {
   251     static DistMap *createDistMap(const _Graph& graph) {
   250       return new DistMap(graph);
   252       return new DistMap(graph);
   251     }
   253     }
   252 
   254 
   679     /// computes
   681     /// computes
   680     /// - The shortest path tree.
   682     /// - The shortest path tree.
   681     /// - The distance of each node from the root.
   683     /// - The distance of each node from the root.
   682     ///
   684     ///
   683     /// \note d.run(s) is just a shortcut of the following code.
   685     /// \note d.run(s) is just a shortcut of the following code.
   684     /// \code
   686     ///\code
   685     ///  d.init();
   687     ///  d.init();
   686     ///  d.addSource(s);
   688     ///  d.addSource(s);
   687     ///  d.start();
   689     ///  d.start();
   688     /// \endcode
   690     ///\endcode
   689     void run(Node s) {
   691     void run(Node s) {
   690       init();
   692       init();
   691       addSource(s);
   693       addSource(s);
   692       start();
   694       start();
   693     }
   695     }
   975     }
   977     }
   976 
   978 
   977     /// \brief Runs DagShortestPath algorithm from the given node.
   979     /// \brief Runs DagShortestPath algorithm from the given node.
   978     ///
   980     ///
   979     /// Runs DagShortestPath algorithm from the given node.
   981     /// Runs DagShortestPath algorithm from the given node.
   980     /// \param s is the given source.
   982     /// \param source is the given source.
   981     void run(Node source) {
   983     void run(Node source) {
   982       Base::_source = source;
   984       Base::_source = source;
   983       run();
   985       run();
   984     }
   986     }
   985 
   987 
  1040     }
  1042     }
  1041     
  1043     
  1042     /// \brief Sets the source node, from which the DagShortestPath algorithm runs.
  1044     /// \brief Sets the source node, from which the DagShortestPath algorithm runs.
  1043     ///
  1045     ///
  1044     /// Sets the source node, from which the DagShortestPath algorithm runs.
  1046     /// Sets the source node, from which the DagShortestPath algorithm runs.
  1045     /// \param s is the source node.
  1047     /// \param source is the source node.
  1046     DagShortestPathWizard<_Traits>& source(Node source) {
  1048     DagShortestPathWizard<_Traits>& source(Node source) {
  1047       Base::_source = source;
  1049       Base::_source = source;
  1048       return *this;
  1050       return *this;
  1049     }
  1051     }
  1050     
  1052     
  1058   /// This function also has several \ref named-templ-func-param 
  1060   /// This function also has several \ref named-templ-func-param 
  1059   /// "named parameters", they are declared as the members of class 
  1061   /// "named parameters", they are declared as the members of class 
  1060   /// \ref DagShortestPathWizard.
  1062   /// \ref DagShortestPathWizard.
  1061   /// The following
  1063   /// The following
  1062   /// example shows how to use these parameters.
  1064   /// example shows how to use these parameters.
  1063   /// \code
  1065   ///\code
  1064   /// dagShortestPath(g,length,source).predMap(preds).run();
  1066   /// dagShortestPath(g,length,source).predMap(preds).run();
  1065   /// \endcode
  1067   ///\endcode
  1066   /// \warning Don't forget to put the \ref DagShortestPathWizard::run() "run()"
  1068   /// \warning Don't forget to put the \ref DagShortestPathWizard::run() "run()"
  1067   /// to the end of the parameter list.
  1069   /// to the end of the parameter list.
  1068   /// \sa DagShortestPathWizard
  1070   /// \sa DagShortestPathWizard
  1069   /// \sa DagShortestPath
  1071   /// \sa DagShortestPath
  1070   template<class _Graph, class _LengthMap>
  1072   template<class _Graph, class _LengthMap>