equal
deleted
inserted
replaced
85 bool local_distance; |
85 bool local_distance; |
86 |
86 |
87 //The source node of the last execution. |
87 //The source node of the last execution. |
88 Node source; |
88 Node source; |
89 |
89 |
90 ///Initialize maps |
90 ///Initializes the maps. |
91 |
91 |
92 ///\todo Error if \c G or are \c NULL. What about \c length? |
92 ///\todo Error if \c G or are \c NULL. What about \c length? |
93 ///\todo Better memory allocation (instead of new). |
93 ///\todo Better memory allocation (instead of new). |
94 void init_maps() |
94 void init_maps() |
95 { |
95 { |
130 |
130 |
131 ///Sets the graph the algorithm will run on. |
131 ///Sets the graph the algorithm will run on. |
132 |
132 |
133 ///Sets the graph the algorithm will run on. |
133 ///Sets the graph the algorithm will run on. |
134 ///\return <tt> (*this) </tt> |
134 ///\return <tt> (*this) </tt> |
|
135 ///\bug What about maps? |
|
136 ///\todo It may be unnecessary |
135 Dijkstra &setGraph(const Graph &_G) |
137 Dijkstra &setGraph(const Graph &_G) |
136 { |
138 { |
137 G = &_G; |
139 G = &_G; |
138 return *this; |
140 return *this; |
139 } |
141 } |
271 ValueType dist(Node v) const { return (*distance)[v]; } |
273 ValueType dist(Node v) const { return (*distance)[v]; } |
272 |
274 |
273 ///Returns the 'previous edge' of the shortest path tree. |
275 ///Returns the 'previous edge' of the shortest path tree. |
274 |
276 |
275 ///For a node \c v it returns the 'previous edge' of the shortest path tree, |
277 ///For a node \c v it returns the 'previous edge' of the shortest path tree, |
276 ///i.e. it returns the last edge from a shortest path from the root to \c |
278 ///i.e. it returns the last edge of a shortest path from the root to \c |
277 ///v. It is \ref INVALID |
279 ///v. It is \ref INVALID |
278 ///if \c v is unreachable from the root or if \c v=s. The |
280 ///if \c v is unreachable from the root or if \c v=s. The |
279 ///shortest path tree used here is equal to the shortest path tree used in |
281 ///shortest path tree used here is equal to the shortest path tree used in |
280 ///\ref predNode(Node v). \pre \ref run() must be called before using |
282 ///\ref predNode(Node v). \pre \ref run() must be called before using |
281 ///this function. |
283 ///this function. |
320 /// |
322 /// |
321 bool reached(Node v) { return v==source || (*predecessor)[v]!=INVALID; } |
323 bool reached(Node v) { return v==source || (*predecessor)[v]!=INVALID; } |
322 |
324 |
323 }; |
325 }; |
324 |
326 |
325 |
|
326 // ********************************************************************** |
|
327 // IMPLEMENTATIONS |
|
328 // ********************************************************************** |
|
329 |
|
330 /// @} |
327 /// @} |
331 |
328 |
332 } //END OF NAMESPACE HUGO |
329 } //END OF NAMESPACE HUGO |
333 |
330 |
334 #endif |
331 #endif |