[Lemon-commits] [lemon_svn] alpar: r1640 - in hugo/trunk/src: lemon test
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:46:44 CET 2006
Author: alpar
Date: Wed Mar 16 17:40:21 2005
New Revision: 1640
Modified:
hugo/trunk/src/lemon/dfs.h
hugo/trunk/src/lemon/dijkstra.h
hugo/trunk/src/test/bfs_test.cc
hugo/trunk/src/test/dfs_test.cc
hugo/trunk/src/test/dijkstra_test.cc
Log:
- Add compilation tests for the function type interface of BFS/DFS/Dijkstra
- Fix the bugs covered up by these tests
Modified: hugo/trunk/src/lemon/dfs.h
==============================================================================
--- hugo/trunk/src/lemon/dfs.h (original)
+++ hugo/trunk/src/lemon/dfs.h Wed Mar 16 17:40:21 2005
@@ -431,6 +431,40 @@
return *this;
}
+ ///Sets the map indicating if a node is reached.
+
+ ///Sets the map indicating if a node is reached.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &reachedMap(ReachedMap &m)
+ {
+ if(local_reached) {
+ delete _reached;
+ local_reached=false;
+ }
+ _reached = &m;
+ return *this;
+ }
+
+ ///Sets the map indicating if a node is processed.
+
+ ///Sets the map indicating if a node is processed.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &processedMap(ProcessedMap &m)
+ {
+ if(local_processed) {
+ delete _processed;
+ local_processed=false;
+ }
+ _processed = &m;
+ return *this;
+ }
+
public:
///\name Execution control
///The simplest way to execute the algorithm is to use
Modified: hugo/trunk/src/lemon/dijkstra.h
==============================================================================
--- hugo/trunk/src/lemon/dijkstra.h (original)
+++ hugo/trunk/src/lemon/dijkstra.h Wed Mar 16 17:40:21 2005
@@ -807,6 +807,7 @@
///as well as the \ref Dijkstra class.
/// The \ref DijkstraWizardBase is a class to be the default traits of the
/// \ref DijkstraWizard class.
+ /// \todo More named parameters are required...
template<class GR,class LM>
class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LM>
{
Modified: hugo/trunk/src/test/bfs_test.cc
==============================================================================
--- hugo/trunk/src/test/bfs_test.cc (original)
+++ hugo/trunk/src/test/bfs_test.cc Wed Mar 16 17:40:21 2005
@@ -58,6 +58,28 @@
}
+void check_Bfs_Function_Compile()
+{
+ typedef int VType;
+ typedef concept::StaticGraph Graph;
+
+ typedef Graph::Edge Edge;
+ typedef Graph::Node Node;
+ typedef Graph::EdgeIt EdgeIt;
+ typedef Graph::NodeIt NodeIt;
+ typedef concept::ReadMap<Edge,VType> LengthMap;
+
+ bfs(Graph(),Node()).run();
+ bfs(Graph()).source(Node()).run();
+ bfs(Graph())
+ .predMap(concept::WriteMap<Node,Edge>())
+ .distMap(concept::WriteMap<Node,VType>())
+ .reachedMap(concept::ReadWriteMap<Node,bool>())
+ .processedMap(concept::WriteMap<Node,bool>())
+ .run(Node());
+
+}
+
int main()
{
Modified: hugo/trunk/src/test/dfs_test.cc
==============================================================================
--- hugo/trunk/src/test/dfs_test.cc (original)
+++ hugo/trunk/src/test/dfs_test.cc Wed Mar 16 17:40:21 2005
@@ -58,6 +58,29 @@
}
+
+void check_Dfs_Function_Compile()
+{
+ typedef int VType;
+ typedef concept::StaticGraph Graph;
+
+ typedef Graph::Edge Edge;
+ typedef Graph::Node Node;
+ typedef Graph::EdgeIt EdgeIt;
+ typedef Graph::NodeIt NodeIt;
+ typedef concept::ReadMap<Edge,VType> LengthMap;
+
+ dfs(Graph(),Node()).run();
+ dfs(Graph()).source(Node()).run();
+ dfs(Graph())
+ .predMap(concept::WriteMap<Node,Edge>())
+ .distMap(concept::WriteMap<Node,VType>())
+ .reachedMap(concept::ReadWriteMap<Node,bool>())
+ .processedMap(concept::WriteMap<Node,bool>())
+ .run(Node());
+
+}
+
int main()
{
Modified: hugo/trunk/src/test/dijkstra_test.cc
==============================================================================
--- hugo/trunk/src/test/dijkstra_test.cc (original)
+++ hugo/trunk/src/test/dijkstra_test.cc Wed Mar 16 17:40:21 2005
@@ -62,6 +62,27 @@
}
+void check_Dijkstra_Function_Compile()
+{
+ typedef int VType;
+ typedef concept::StaticGraph Graph;
+
+ typedef Graph::Edge Edge;
+ typedef Graph::Node Node;
+ typedef Graph::EdgeIt EdgeIt;
+ typedef Graph::NodeIt NodeIt;
+ typedef concept::ReadMap<Edge,VType> LengthMap;
+
+ dijkstra(Graph(),LengthMap(),Node()).run();
+ dijkstra(Graph(),LengthMap()).source(Node()).run();
+ dijkstra(Graph(),LengthMap())
+ .predMap(concept::WriteMap<Node,Edge>())
+ .distMap(concept::WriteMap<Node,VType>())
+ .run(Node());
+
+}
+
+
int main()
{
More information about the Lemon-commits
mailing list