COIN-OR::LEMON - Graph Library

Changeset 1526:8c14aa8f27a2 in lemon-0.x


Ignore:
Timestamp:
06/30/05 18:13:30 (14 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2012
Message:

Mainly doc review.

Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • demo/Makefile.am

    r1520 r1526  
    66noinst_PROGRAMS = \
    77        dim_to_dot \
     8        dijkstra_demo \
    89        dim_to_lgf \
    910        graph_to_eps_demo \
     
    2324
    2425dim_to_dot_SOURCES = dim_to_dot.cc
     26
     27dijkstra_demo_SOURCES = dijkstra_demo.cc
    2528
    2629dim_to_lgf_SOURCES = dim_to_lgf.cc
  • demo/dijkstra_demo.cc

    r1521 r1526  
    33#include <lemon/list_graph.h>
    44#include <lemon/dijkstra.h>
    5 //#include <lemon/bits/item_writer.h>
     5//#include <lemon/graph_writer.h>
    66
    77using namespace lemon;
     
    5050
    5151//     GraphWriter<ListGraph> writer(std::cout, g);
    52 //     writer.writeEdgeMap("capacity", length);
     52//     writer.writeEdgeMap("capacity", len);
    5353//     writer.writeNode("source", s);
    5454//     writer.writeNode("target", t);
  • demo/hello_lemon.cc

    r1520 r1526  
    1818      if (i != j) g.addEdge(i, j);
    1919
     20  std::cout << "Hello World!" << std::endl;
     21  std::cout <<  std::endl;
     22  std::cout << "This is library LEMON here! We have a graph!" << std::endl;
     23  std::cout <<  std::endl;
     24
    2025  std::cout << "Nodes:";
    2126  for (NodeIt i(g); i!=INVALID; ++i)
  • doc/graph_io.dox

    r1522 r1526  
    9494
    9595The \c GraphWriter class provides the graph output. To write a graph
    96 you should first give writing commands for the writer. You can declare
     96you should first give writing commands to the writer. You can declare
    9797write command as \c NodeMap or \c EdgeMap writing and labeled Node and
    9898Edge writing.
     
    249249
    250250The global functionality of the reader class can be changed by giving a
    251 special template parameter for the GraphReader class. By default, the
     251special template parameter to the GraphReader class. By default, the
    252252template parameter is \c DefaultReaderTraits. A reader traits class
    253253should provide an inner template class Reader for each type, and an
  • doc/quicktour.dox

    r1522 r1526  
    4545will suppose them later as well. 
    4646
    47 \code
    48 
    49   typedef ListGraph Graph;
    50   typedef Graph::NodeIt NodeIt;
    51 
    52   Graph g;
    53  
    54   for (int i = 0; i < 3; i++)
    55     g.addNode();
    56  
    57   for (NodeIt i(g); i!=INVALID; ++i)
    58     for (NodeIt j(g); j!=INVALID; ++j)
    59       if (i != j) g.addEdge(i, j);
    60 
    61 \endcode
    62 
    63 See the whole program in file \ref helloworld.cc.
    64 
    65     If you want to read more on the LEMON graph structures and concepts, read the page about \ref graphs "graphs".
    66 
    67 <li> The following code shows how to read a graph from a stream (e.g. a file)
    68 in the DIMACS file format (find the documentation of the DIMACS file formats on the web).
     47\dontinclude hello_lemon.cc
     48\skip ListGraph
     49\until addEdge
     50
     51See the whole program in file \ref hello_lemon.cc in \c demo subdir of
     52LEMON package.
     53
     54    If you want to read more on the LEMON graph structures and
     55concepts, read the page about \ref graphs "graphs".
     56
     57<li> The following code shows how to read a graph from a stream
     58(e.g. a file) in the DIMACS file format (find the documentation of the
     59DIMACS file formats on the web).
    6960
    7061\code
     
    7465\endcode
    7566
    76 One can also store network (graph+capacity on the edges) instances and other
    77 things (minimum cost flow instances etc.) in DIMACS format and use these in LEMON: to see the details read the
    78 documentation of the \ref dimacs.h "Dimacs file format reader". There you will
    79 also find the details about the output routines into files of the DIMACS
    80 format.
    81 
    82 <li>We needed much greater flexibility than the DIMACS formats could give us,
     67One can also store network (graph+capacity on the edges) instances and
     68other things (minimum cost flow instances etc.) in DIMACS format and
     69use these in LEMON: to see the details read the documentation of the
     70\ref dimacs.h "Dimacs file format reader". There you will also find
     71the details about the output routines into files of the DIMACS format.
     72
     73<li>DIMACS formats could not give us the flexibility we needed,
    8374so we worked out our own file format. Instead of any explanation let us give a
    8475short example file in this format: read the detailed description of the LEMON
     
    240231
    241232So far we have an
    242 interface for the commercial LP solver software \b CLPLEX (developed by ILOG)
     233interface for the commercial LP solver software \b CPLEX (developed by ILOG)
    243234and for the open source solver \b GLPK (a shorthand for Gnu Linear Programming
    244235Toolkit).
  • lemon/concept/sym_graph.h

    r1435 r1526  
    3737    /// graph structure, however completely without implementations and
    3838    /// real data structures behind the interface.
    39     /// All graph algorithms should compile with this class, but it will not
     39    /// All graph algorithms should compile with this class, but they will not
    4040    /// run properly, of course.
    4141    ///
     
    5252      /// Defalult constructor.
    5353
    54       /// Defalult constructor.
     54      /// Default constructor.
    5555      ///
    5656      StaticSymGraph() { }
     
    596596    {
    597597    public:
    598       /// Defalult constructor.
    599 
    600       /// Defalult constructor.
     598      /// Default constructor.
     599
     600      /// Default constructor.
    601601      ///
    602602      ExtendableSymGraph() { }
     
    628628    {
    629629    public:
    630       /// Defalult constructor.
    631 
    632       /// Defalult constructor.
     630      /// Default constructor.
     631
     632      /// Default constructor.
    633633      ///
    634634      ErasableSymGraph() { }
  • lemon/graph_utils.h

    r1515 r1526  
    7474  /// This function counts the nodes in the graph.
    7575  /// The complexity of the function is O(n) but for some
    76   /// graph structure it is specialized to run in O(1).
     76  /// graph structures it is specialized to run in O(1).
    7777  ///
    7878  /// \todo refer how to specialize it
     
    101101  /// This function counts the edges in the graph.
    102102  /// The complexity of the function is O(e) but for some
    103   /// graph structure it is specialized to run in O(1).
     103  /// graph structures it is specialized to run in O(1).
    104104
    105105  template <typename Graph>
     
    122122  }
    123123
    124   /// \brief Function to count the edges in the graph.
    125   ///
    126   /// This function counts the edges in the graph.
     124  /// \brief Function to count the undirected edges in the graph.
     125  ///
     126  /// This function counts the undirected edges in the graph.
    127127  /// The complexity of the function is O(e) but for some
    128128  /// graph structure it is specialized to run in O(1).
     
    175175  }
    176176 
    177   ///\e
    178 
    179   ///\todo Please document.
    180   ///
     177  /// \brief Function to count the number of the out-edges from node \c n.
     178  ///
     179  /// This function counts the number of the out-edges from node \c n
     180  /// in the graph. 
    181181  template <typename Graph>
    182182  inline int countOutEdges(const Graph& _g,  const typename Graph::Node& _n) {
     
    184184  }
    185185
    186   ///\e
    187 
    188   ///\todo Please document.
    189   ///
     186  /// \brief Function to count the number of the in-edges to node \c n.
     187  ///
     188  /// This function counts the number of the in-edges to node \c n
     189  /// in the graph. 
    190190  template <typename Graph>
    191191  inline int countInEdges(const Graph& _g,  const typename Graph::Node& _n) {
     
    365365  /// Provides an immutable and unique id for each item in the graph.
    366366
    367   /// The IdMap class provides an unique and immutable mapping for each item
     367  /// The IdMap class provides a unique and immutable mapping for each item
    368368  /// in the graph.
    369369  ///
     
    430430
    431431 
    432   /// \brief General inversable graph-map type.
    433 
    434   /// This type provides simple inversable map functions.
    435   /// The InversableMap wraps an arbitrary ReadWriteMap
    436   /// and if a key is setted to a new value then store it
     432  /// \brief General invertable graph-map type.
     433
     434  /// This type provides simple invertable map functions.
     435  /// The InvertableMap wraps an arbitrary ReadWriteMap
     436  /// and if a key is set to a new value then store it
    437437  /// in the inverse map.
    438438  /// \param _Graph The graph type.
    439   /// \param _Map The map to extend with inversable functionality.
     439  /// \param _Map The map to extend with invertable functionality.
    440440  template <
    441441    typename _Graph,
  • lemon/graph_writer.h

    r1435 r1526  
    3434  /// \brief The graph writer class.
    3535  ///
    36   /// The \c GraphWriter class provides the graph output. To write a graph
    37   /// you should first give writing commands for the writer. You can declare
    38   /// write command as \c NodeMap or \c EdgeMap writing and labeled Node and
     36  /// The \c GraphWriter class provides the graph output.
     37  /// Before you read this documentation it might be useful to read the general
     38  /// description of  \ref graph-io-page "Graph Input-Output".
     39  /// To write a graph
     40  /// you should first give writing commands to the writer. You can declare
     41  /// write commands as \c NodeMap or \c EdgeMap writing and labeled Node and
    3942  /// Edge writing.
    4043  ///
     
    4750  /// the name of the map and the map object. The NodeMap writing
    4851  /// command with name "id" should write a unique map because it
    49   /// is regarded as ID map.
     52  /// is regarded as ID map (such a map is essential if the graph has edges).
    5053  ///
    5154  /// \code
     
    7073  ///
    7174  /// With \c writeNode() and \c writeEdge() functions you can
    72   /// point out Nodes and Edges in the graph. By example, you can
    73   /// write out the source and target of the graph.
     75  /// point out Nodes and Edges in the graph. For example, you can
     76  /// write out the source and target of a maximum flow instance.
    7477  ///
    7578  /// \code
     
    8184  ///
    8285  /// After you give all write commands you must call the \c run() member
    83   /// function, which execute all the writer commands.
     86  /// function, which executes all the writing commands.
    8487  ///
    8588  /// \code
     
    106109    /// \brief Construct a new GraphWriter.
    107110    ///
    108     /// Construct a new GraphWriter. It writes the given graph
     111    /// This function constructs a new GraphWriter to write the given graph
    109112    /// to the given stream.
    110113    GraphWriter(std::ostream& _os, const Graph& _graph)
     
    118121    /// \brief Construct a new GraphWriter.
    119122    ///
    120     /// Construct a new GraphWriter. It writes into the given graph
     123    /// This function constructs a new GraphWriter to write the given graph
    121124    /// to the given file.
    122125    GraphWriter(const std::string& _filename, const Graph& _graph)
     
    130133    /// \brief Construct a new GraphWriter.
    131134    ///
    132     /// Construct a new GraphWriter. It writes into the given graph
    133     /// to given LemonReader.
     135    /// This function constructs a new GraphWriter to write the given graph
     136    /// to the given LemonReader.
    134137    GraphWriter(LemonWriter& _writer, const Graph& _graph)
    135138      : writer(_writer), own_writer(false),
     
    142145    /// \brief Destruct the graph writer.
    143146    ///
    144     /// Destruct the graph writer.
     147    /// This function destructs the graph writer.
    145148    ~GraphWriter() {
    146149      if (own_writer)
     
    148151    }
    149152
    150     /// \brief Add a new node map writer command for the writer.
    151     ///
    152     /// Add a new node map writer command for the writer.
     153    /// \brief Issue a new node map writing command for the writer.
     154    ///
     155   /// This function issues a new <i> node map writing command</i> to the writer.
    153156    template <typename Map>
    154157    GraphWriter& writeNodeMap(std::string name, const Map& map) {
     
    157160    }
    158161
    159     /// \brief Add a new node map writer command for the writer.
    160     ///
    161     /// Add a new node map writer command for the writer.
     162    /// \brief Issue a new node map writing command for the writer.
     163    ///
     164   /// This function issues a new <i> node map writing command</i> to the writer.
    162165    template <typename Writer, typename Map>
    163166    GraphWriter& writeNodeMap(std::string name, const Map& map,
     
    168171
    169172
    170     /// \brief Add a new edge map writer command for the writer.
    171     ///
    172     /// Add a new edge map writer command for the writer.
     173    /// \brief Issue a new edge map writing command for the writer.
     174    ///
     175   /// This function issues a new <i> edge map writing command</i> to the writer.
    173176    template <typename Map>
    174177    GraphWriter& writeEdgeMap(std::string name, const Map& map) {
     
    178181
    179182
    180     /// \brief Add a new edge map writer command for the writer.
    181     ///
    182     /// Add a new edge map writer command for the writer.
     183    /// \brief Issue a new edge map writing command for the writer.
     184    ///
     185   /// This function issues a new <i> edge map writing command</i> to the writer.
    183186    template <typename Writer, typename Map>
    184187    GraphWriter& writeEdgeMap(std::string name, const Map& map,
     
    188191    }
    189192
    190     /// \brief Add a new labeled node writer for the writer.
    191     ///
    192     /// Add a new labeled node writer for the writer.
     193    /// \brief Issue a new labeled node writing command to the writer.
     194    ///
     195    /// This function issues a new <i> labeled node writing command</i>
     196    /// to the writer.
    193197    GraphWriter& writeNode(std::string name, const Node& node) {
    194198      node_writer.writeNode(name, node);
     
    196200    }
    197201
    198     /// \brief Add a new labeled edge writer for the writer.
    199     ///
    200     /// Add a new labeled edge writer for the writer.
     202    /// \brief Issue a new labeled edge writing command to the writer.
     203    ///
     204    /// This function issues a new <i> labeled edge writing command</i>
     205    /// to the writer.
    201206    GraphWriter& writeEdge(std::string name, const Edge& edge) {
    202207      edge_writer.writeEdge(name, edge);
    203208    }
    204209
    205     /// \brief Add a new attribute writer command.
    206     ///
    207     ///  Add a new attribute writer command.
     210    /// \brief Issue a new attribute writing command.
     211    ///
     212    /// This function issues a new <i> attribute writing command</i>
     213    /// to the writer.
    208214    template <typename Value>
    209215    GraphWriter& writeAttribute(std::string name, const Value& value) {
     
    212218    }
    213219   
    214     /// \brief Add a new attribute writer command.
    215     ///
    216     ///  Add a new attribute writer command.
     220    /// \brief Issue a new attribute writing command.
     221    ///
     222    /// This function issues a new <i> attribute writing command</i>
     223    /// to the writer.
    217224    template <typename Writer, typename Value>
    218225    GraphWriter& writeAttribute(std::string name, const Value& value,
     
    224231    /// \brief Conversion operator to LemonWriter.
    225232    ///
    226     /// Conversion operator to LemonWriter. It make possible
     233    /// Conversion operator to LemonWriter. It makes possible
    227234    /// to access the encapsulated \e LemonWriter, this way
    228235    /// you can attach to this writer new instances of
     
    232239    }
    233240
    234     /// \brief Executes the writer commands.
    235     ///
    236     /// Executes the writer commands.
     241    /// \brief Executes the writing commands.
     242    ///
     243    /// Executes the writing commands.
    237244    void run() {
    238245      writer->run();
     
    242249    ///
    243250    /// It writes the id of the given node. If there was written an "id"
    244     /// named node map then it will write the map value belongs to the node.
     251    /// named node map then it will write the map value belonging to the node.
    245252    void writeId(std::ostream& os, const Node& item) const {
    246253      nodeset_writer.writeId(os, item);
     
    250257    ///
    251258    /// It writes the id of the given edge. If there was written an "id"
    252     /// named edge map then it will write the map value belongs to the edge.
     259    /// named edge map then it will write the map value belonging to the edge.
    253260    void writeId(std::ostream& os, const Edge& item) const {
    254261      edgeset_writer.writeId(os, item);
     
    374381  ///
    375382  /// The \c UndirGraphWriter class provides the undir graph output. To write
    376   /// a graph you should first give writing commands for the writer. You can
     383  /// a graph you should first give writing commands to the writer. You can
    377384  /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap
    378385  /// writing and labeled Node, Edge or UndirEdge writing.
     
    417424  ///
    418425  /// With \c writeNode() and \c writeUndirEdge() functions you can
    419   /// point out nodes and undirected edges in the graph. By example, you can
     426  /// designate nodes and undirected edges in the graph. For example, you can
    420427  /// write out the source and target of the graph.
    421428  ///
     
    428435  ///
    429436  /// After you give all write commands you must call the \c run() member
    430   /// function, which execute all the writer commands.
     437  /// function, which executes all the writing commands.
    431438  ///
    432439  /// \code
     
    466473    /// \brief Construct a new UndirGraphWriter.
    467474    ///
    468     /// Construct a new UndirGraphWriter. It writes into the given graph
     475    /// Construct a new UndirGraphWriter. It writes the given graph
    469476    /// to the given file.
    470477    UndirGraphWriter(const std::string& _filename, const Graph& _graph)
     
    478485    /// \brief Construct a new UndirGraphWriter.
    479486    ///
    480     /// Construct a new UndirGraphWriter. It writes into the given graph
     487    /// Construct a new UndirGraphWriter. It writes the given graph
    481488    /// to given LemonReader.
    482489    UndirGraphWriter(LemonWriter& _writer, const Graph& _graph)
     
    496503    }
    497504
    498     /// \brief Add a new node map writer command for the writer.
    499     ///
    500     /// Add a new node map writer command for the writer.
     505    /// \brief Issue a new node map writing command to the writer.
     506    ///
     507   /// This function issues a new <i> node map writing command</i> to the writer.
    501508    template <typename Map>
    502509    UndirGraphWriter& writeNodeMap(std::string name, const Map& map) {
     
    505512    }
    506513
    507     /// \brief Add a new node map writer command for the writer.
    508     ///
    509     /// Add a new node map writer command for the writer.
     514    /// \brief Issue a new node map writing command to the writer.
     515    ///
     516   /// This function issues a new <i> node map writing command</i> to the writer.
    510517    template <typename Writer, typename Map>
    511518    UndirGraphWriter& writeNodeMap(std::string name, const Map& map,
     
    515522    }
    516523
    517     /// \brief Add a new edge map writer command for the writer.
    518     ///
    519     /// Add a new edge map writer command for the writer.
     524    /// \brief Issue a new edge map writing command to the writer.
     525    ///
     526   /// This function issues a new <i> edge map writing command</i> to the writer.
    520527    template <typename Map>
    521528    UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) {
     
    524531    }
    525532
    526     /// \brief Add a new edge map writer command for the writer.
    527     ///
    528     /// Add a new edge map writer command for the writer.
     533    /// \brief Issue a new edge map writing command to the writer.
     534    ///
     535   /// This function issues a new <i> edge map writing command</i> to the writer.
    529536    template <typename Writer, typename Map>
    530537    UndirGraphWriter& writeEdgeMap(std::string name, const Map& map,
     
    534541    }
    535542
    536     /// \brief Add a new undirected edge map writer command for the writer.
    537     ///
    538     /// Add a new undirected edge map writer command for the writer.
     543    /// \brief Issue a new undirected edge map writing command to the writer.
     544    ///
     545    /// This function issues a new <i> undirected edge map writing
     546    /// command</i> to the writer.
    539547    template <typename Map>
    540548    UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) {
     
    543551    }
    544552
    545     /// \brief Add a new undirected edge map writer command for the writer.
    546     ///
    547     /// Add a new edge undirected map writer command for the writer.
     553    /// \brief Issue a new undirected edge map writing command to the writer.
     554    ///
     555    /// This function issues a new <i> undirected edge map writing
     556    /// command</i> to the writer.
    548557    template <typename Writer, typename Map>
    549558    UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map,
     
    553562    }
    554563
    555     /// \brief Add a new labeled node writer for the writer.
    556     ///
    557     /// Add a new labeled node writer for the writer.
     564    /// \brief Issue a new labeled node writer to the writer.
     565    ///
     566    /// This function issues a new <i> labeled node writing
     567    /// command</i> to the writer.
    558568    UndirGraphWriter& writeNode(std::string name, const Node& node) {
    559569      node_writer.writeNode(name, node);
     
    561571    }
    562572
    563     /// \brief Add a new labeled edge writer for the writer.
    564     ///
    565     /// Add a new labeled edge writer for the writer.
     573    /// \brief Issue a new labeled edge writer to the writer.
     574    ///
     575    /// This function issues a new <i> labeled edge writing
     576    /// command</i> to the writer.
    566577    UndirGraphWriter& writeEdge(std::string name, const Edge& edge) {
    567578      undir_edge_writer.writeEdge(name, edge);
    568579    }
    569580
    570     /// \brief Add a new labeled undirected edge writer for the writer.
    571     ///
    572     /// Add a new labeled undirected edge writer for the writer.
     581    /// \brief Issue a new labeled undirected edge writing command to
     582    /// the writer.
     583    ///
     584    /// Issue a new <i>labeled undirected edge writing command</i> to
     585    /// the writer.
    573586    UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) {
    574587      undir_edge_writer.writeUndirEdge(name, edge);
    575588    }
    576589
    577     /// \brief Add a new attribute writer command.
    578     ///
    579     ///  Add a new attribute writer command.
     590    /// \brief Issue a new attribute writing command.
     591    ///
     592    /// This function issues a new <i> attribute writing
     593    /// command</i> to the writer.
    580594    template <typename Value>
    581595    UndirGraphWriter& writeAttribute(std::string name, const Value& value) {
     
    584598    }
    585599   
    586     /// \brief Add a new attribute writer command.
    587     ///
    588     ///  Add a new attribute writer command.
     600    /// \brief Issue a new attribute writing command.
     601    ///
     602    /// This function issues a new <i> attribute writing
     603    /// command</i> to the writer.
    589604    template <typename Writer, typename Value>
    590605    UndirGraphWriter& writeAttribute(std::string name, const Value& value,
     
    596611    /// \brief Conversion operator to LemonWriter.
    597612    ///
    598     /// Conversion operator to LemonWriter. It make possible
     613    /// Conversion operator to LemonWriter. It makes possible
    599614    /// to access the encapsulated \e LemonWriter, this way
    600615    /// you can attach to this writer new instances of
     
    604619    }
    605620
    606     /// \brief Executes the writer commands.
    607     ///
    608     /// Executes the writer commands.
     621    /// \brief Executes the writing commands.
     622    ///
     623    /// Executes the writing commands.
    609624    void run() {
    610625      writer->run();
     
    614629    ///
    615630    /// It writes the id of the given node. If there was written an "id"
    616     /// named node map then it will write the map value belongs to the node.
     631    /// named node map then it will write the map value belonging to the node.
    617632    void writeId(std::ostream& os, const Node& item) const {
    618633      nodeset_writer.writeId(os, item);
     
    622637    ///
    623638    /// It writes the id of the given edge. If there was written an "id"
    624     /// named edge map then it will write the map value belongs to the edge.
     639    /// named edge map then it will write the map value belonging to the edge.
    625640    void writeId(std::ostream& os, const Edge& item) const {
    626641      undir_edgeset_writer.writeId(os, item);
     
    630645    ///
    631646    /// It writes the id of the given undirected edge. If there was written
    632     /// an "id" named edge map then it will write the map value belongs to
     647    /// an "id" named edge map then it will write the map value belonging to
    633648    /// the edge.
    634649    void writeId(std::ostream& os, const UndirEdge& item) const {
     
    652667
    653668
    654   /// \brief Write an undirected graph to the output.
    655   ///
    656   /// Write an undirected graph to the output.
     669  /// \brief Write an undirected multigraph (undirected graph + capacity
     670  /// map on the edges) to the output.
     671  ///
     672  /// Write an undirected multigraph (undirected graph + capacity
     673  /// map on the edges) to the output.
    657674  /// \param os The output stream.
    658675  /// \param g The graph.
Note: See TracChangeset for help on using the changeset viewer.