COIN-OR::LEMON - Graph Library

Changeset 1220:20b26ee5812b in lemon-0.x for src


Ignore:
Timestamp:
03/16/05 17:40:21 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1640
Message:
  • Add compilation tests for the function type interface of BFS/DFS/Dijkstra
  • Fix the bugs covered up by these tests
Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/dfs.h

    r1218 r1220  
    432432    }
    433433
     434    ///Sets the map indicating if a node is reached.
     435
     436    ///Sets the map indicating if a node is reached.
     437    ///If you don't use this function before calling \ref run(),
     438    ///it will allocate one. The destuctor deallocates this
     439    ///automatically allocated map, of course.
     440    ///\return <tt> (*this) </tt>
     441    Dfs &reachedMap(ReachedMap &m)
     442    {
     443      if(local_reached) {
     444        delete _reached;
     445        local_reached=false;
     446      }
     447      _reached = &m;
     448      return *this;
     449    }
     450
     451    ///Sets the map indicating if a node is processed.
     452
     453    ///Sets the map indicating if a node is processed.
     454    ///If you don't use this function before calling \ref run(),
     455    ///it will allocate one. The destuctor deallocates this
     456    ///automatically allocated map, of course.
     457    ///\return <tt> (*this) </tt>
     458    Dfs &processedMap(ProcessedMap &m)
     459    {
     460      if(local_processed) {
     461        delete _processed;
     462        local_processed=false;
     463      }
     464      _processed = &m;
     465      return *this;
     466    }
     467
    434468  public:
    435469    ///\name Execution control
  • src/lemon/dijkstra.h

    r1218 r1220  
    808808  /// The \ref DijkstraWizardBase is a class to be the default traits of the
    809809  /// \ref DijkstraWizard class.
     810  /// \todo More named parameters are required...
    810811  template<class GR,class LM>
    811812  class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LM>
  • src/test/bfs_test.cc

    r1218 r1220  
    5959}
    6060
     61void check_Bfs_Function_Compile()
     62{
     63  typedef int VType;
     64  typedef concept::StaticGraph Graph;
     65
     66  typedef Graph::Edge Edge;
     67  typedef Graph::Node Node;
     68  typedef Graph::EdgeIt EdgeIt;
     69  typedef Graph::NodeIt NodeIt;
     70  typedef concept::ReadMap<Edge,VType> LengthMap;
     71   
     72  bfs(Graph(),Node()).run();
     73  bfs(Graph()).source(Node()).run();
     74  bfs(Graph())
     75    .predMap(concept::WriteMap<Node,Edge>())
     76    .distMap(concept::WriteMap<Node,VType>())
     77    .reachedMap(concept::ReadWriteMap<Node,bool>())
     78    .processedMap(concept::WriteMap<Node,bool>())
     79    .run(Node());
     80 
     81}
     82
    6183int main()
    6284{
  • src/test/dfs_test.cc

    r1218 r1220  
    5959}
    6060
     61
     62void check_Dfs_Function_Compile()
     63{
     64  typedef int VType;
     65  typedef concept::StaticGraph Graph;
     66
     67  typedef Graph::Edge Edge;
     68  typedef Graph::Node Node;
     69  typedef Graph::EdgeIt EdgeIt;
     70  typedef Graph::NodeIt NodeIt;
     71  typedef concept::ReadMap<Edge,VType> LengthMap;
     72   
     73  dfs(Graph(),Node()).run();
     74  dfs(Graph()).source(Node()).run();
     75  dfs(Graph())
     76    .predMap(concept::WriteMap<Node,Edge>())
     77    .distMap(concept::WriteMap<Node,VType>())
     78    .reachedMap(concept::ReadWriteMap<Node,bool>())
     79    .processedMap(concept::WriteMap<Node,bool>())
     80    .run(Node());
     81 
     82}
     83
    6184int main()
    6285{
  • src/test/dijkstra_test.cc

    r1218 r1220  
    6363}
    6464
     65void check_Dijkstra_Function_Compile()
     66{
     67  typedef int VType;
     68  typedef concept::StaticGraph Graph;
     69
     70  typedef Graph::Edge Edge;
     71  typedef Graph::Node Node;
     72  typedef Graph::EdgeIt EdgeIt;
     73  typedef Graph::NodeIt NodeIt;
     74  typedef concept::ReadMap<Edge,VType> LengthMap;
     75   
     76  dijkstra(Graph(),LengthMap(),Node()).run();
     77  dijkstra(Graph(),LengthMap()).source(Node()).run();
     78  dijkstra(Graph(),LengthMap())
     79    .predMap(concept::WriteMap<Node,Edge>())
     80    .distMap(concept::WriteMap<Node,VType>())
     81    .run(Node());
     82 
     83}
     84
     85
    6586int main()
    6687{
Note: See TracChangeset for help on using the changeset viewer.