Changeset 1526:8c14aa8f27a2 in lemon-0.x
- Timestamp:
- 06/30/05 18:13:30 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2012
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/Makefile.am
r1520 r1526 6 6 noinst_PROGRAMS = \ 7 7 dim_to_dot \ 8 dijkstra_demo \ 8 9 dim_to_lgf \ 9 10 graph_to_eps_demo \ … … 23 24 24 25 dim_to_dot_SOURCES = dim_to_dot.cc 26 27 dijkstra_demo_SOURCES = dijkstra_demo.cc 25 28 26 29 dim_to_lgf_SOURCES = dim_to_lgf.cc -
demo/dijkstra_demo.cc
r1521 r1526 3 3 #include <lemon/list_graph.h> 4 4 #include <lemon/dijkstra.h> 5 //#include <lemon/ bits/item_writer.h>5 //#include <lemon/graph_writer.h> 6 6 7 7 using namespace lemon; … … 50 50 51 51 // GraphWriter<ListGraph> writer(std::cout, g); 52 // writer.writeEdgeMap("capacity", len gth);52 // writer.writeEdgeMap("capacity", len); 53 53 // writer.writeNode("source", s); 54 54 // writer.writeNode("target", t); -
demo/hello_lemon.cc
r1520 r1526 18 18 if (i != j) g.addEdge(i, j); 19 19 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 20 25 std::cout << "Nodes:"; 21 26 for (NodeIt i(g); i!=INVALID; ++i) -
doc/graph_io.dox
r1522 r1526 94 94 95 95 The \c GraphWriter class provides the graph output. To write a graph 96 you should first give writing commands forthe writer. You can declare96 you should first give writing commands to the writer. You can declare 97 97 write command as \c NodeMap or \c EdgeMap writing and labeled Node and 98 98 Edge writing. … … 249 249 250 250 The global functionality of the reader class can be changed by giving a 251 special template parameter forthe GraphReader class. By default, the251 special template parameter to the GraphReader class. By default, the 252 252 template parameter is \c DefaultReaderTraits. A reader traits class 253 253 should provide an inner template class Reader for each type, and an -
doc/quicktour.dox
r1522 r1526 45 45 will suppose them later as well. 46 46 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 51 See the whole program in file \ref hello_lemon.cc in \c demo subdir of 52 LEMON package. 53 54 If you want to read more on the LEMON graph structures and 55 concepts, 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 59 DIMACS file formats on the web). 69 60 70 61 \code … … 74 65 \endcode 75 66 76 One can also store network (graph+capacity on the edges) instances and other77 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,67 One can also store network (graph+capacity on the edges) instances and 68 other things (minimum cost flow instances etc.) in DIMACS format and 69 use 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 71 the details about the output routines into files of the DIMACS format. 72 73 <li>DIMACS formats could not give us the flexibility we needed, 83 74 so we worked out our own file format. Instead of any explanation let us give a 84 75 short example file in this format: read the detailed description of the LEMON … … 240 231 241 232 So far we have an 242 interface for the commercial LP solver software \b C LPLEX (developed by ILOG)233 interface for the commercial LP solver software \b CPLEX (developed by ILOG) 243 234 and for the open source solver \b GLPK (a shorthand for Gnu Linear Programming 244 235 Toolkit). -
lemon/concept/sym_graph.h
r1435 r1526 37 37 /// graph structure, however completely without implementations and 38 38 /// real data structures behind the interface. 39 /// All graph algorithms should compile with this class, but itwill not39 /// All graph algorithms should compile with this class, but they will not 40 40 /// run properly, of course. 41 41 /// … … 52 52 /// Defalult constructor. 53 53 54 /// Defa lult constructor.54 /// Default constructor. 55 55 /// 56 56 StaticSymGraph() { } … … 596 596 { 597 597 public: 598 /// Defa lult constructor.599 600 /// Defa lult constructor.598 /// Default constructor. 599 600 /// Default constructor. 601 601 /// 602 602 ExtendableSymGraph() { } … … 628 628 { 629 629 public: 630 /// Defa lult constructor.631 632 /// Defa lult constructor.630 /// Default constructor. 631 632 /// Default constructor. 633 633 /// 634 634 ErasableSymGraph() { } -
lemon/graph_utils.h
r1515 r1526 74 74 /// This function counts the nodes in the graph. 75 75 /// 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). 77 77 /// 78 78 /// \todo refer how to specialize it … … 101 101 /// This function counts the edges in the graph. 102 102 /// 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). 104 104 105 105 template <typename Graph> … … 122 122 } 123 123 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. 127 127 /// The complexity of the function is O(e) but for some 128 128 /// graph structure it is specialized to run in O(1). … … 175 175 } 176 176 177 /// \e178 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. 181 181 template <typename Graph> 182 182 inline int countOutEdges(const Graph& _g, const typename Graph::Node& _n) { … … 184 184 } 185 185 186 /// \e187 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. 190 190 template <typename Graph> 191 191 inline int countInEdges(const Graph& _g, const typename Graph::Node& _n) { … … 365 365 /// Provides an immutable and unique id for each item in the graph. 366 366 367 /// The IdMap class provides a nunique and immutable mapping for each item367 /// The IdMap class provides a unique and immutable mapping for each item 368 368 /// in the graph. 369 369 /// … … 430 430 431 431 432 /// \brief General inver sable graph-map type.433 434 /// This type provides simple inver sable map functions.435 /// The Inver sableMap wraps an arbitrary ReadWriteMap436 /// and if a key is set tedto a new value then store it432 /// \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 437 437 /// in the inverse map. 438 438 /// \param _Graph The graph type. 439 /// \param _Map The map to extend with inver sable functionality.439 /// \param _Map The map to extend with invertable functionality. 440 440 template < 441 441 typename _Graph, -
lemon/graph_writer.h
r1435 r1526 34 34 /// \brief The graph writer class. 35 35 /// 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 39 42 /// Edge writing. 40 43 /// … … 47 50 /// the name of the map and the map object. The NodeMap writing 48 51 /// 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). 50 53 /// 51 54 /// \code … … 70 73 /// 71 74 /// With \c writeNode() and \c writeEdge() functions you can 72 /// point out Nodes and Edges in the graph. Byexample, you can73 /// 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. 74 77 /// 75 78 /// \code … … 81 84 /// 82 85 /// After you give all write commands you must call the \c run() member 83 /// function, which execute all the writercommands.86 /// function, which executes all the writing commands. 84 87 /// 85 88 /// \code … … 106 109 /// \brief Construct a new GraphWriter. 107 110 /// 108 /// Construct a new GraphWriter. It writesthe given graph111 /// This function constructs a new GraphWriter to write the given graph 109 112 /// to the given stream. 110 113 GraphWriter(std::ostream& _os, const Graph& _graph) … … 118 121 /// \brief Construct a new GraphWriter. 119 122 /// 120 /// Construct a new GraphWriter. It writes intothe given graph123 /// This function constructs a new GraphWriter to write the given graph 121 124 /// to the given file. 122 125 GraphWriter(const std::string& _filename, const Graph& _graph) … … 130 133 /// \brief Construct a new GraphWriter. 131 134 /// 132 /// Construct a new GraphWriter. It writes intothe given graph133 /// to given LemonReader.135 /// This function constructs a new GraphWriter to write the given graph 136 /// to the given LemonReader. 134 137 GraphWriter(LemonWriter& _writer, const Graph& _graph) 135 138 : writer(_writer), own_writer(false), … … 142 145 /// \brief Destruct the graph writer. 143 146 /// 144 /// Destructthe graph writer.147 /// This function destructs the graph writer. 145 148 ~GraphWriter() { 146 149 if (own_writer) … … 148 151 } 149 152 150 /// \brief Add a new node map writercommand for the writer.151 /// 152 /// Add a new node map writer command forthe 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. 153 156 template <typename Map> 154 157 GraphWriter& writeNodeMap(std::string name, const Map& map) { … … 157 160 } 158 161 159 /// \brief Add a new node map writercommand for the writer.160 /// 161 /// Add a new node map writer command forthe 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. 162 165 template <typename Writer, typename Map> 163 166 GraphWriter& writeNodeMap(std::string name, const Map& map, … … 168 171 169 172 170 /// \brief Add a new edge map writercommand for the writer.171 /// 172 /// Add a new edge map writer command forthe 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. 173 176 template <typename Map> 174 177 GraphWriter& writeEdgeMap(std::string name, const Map& map) { … … 178 181 179 182 180 /// \brief Add a new edge map writercommand for the writer.181 /// 182 /// Add a new edge map writer command forthe 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. 183 186 template <typename Writer, typename Map> 184 187 GraphWriter& writeEdgeMap(std::string name, const Map& map, … … 188 191 } 189 192 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. 193 197 GraphWriter& writeNode(std::string name, const Node& node) { 194 198 node_writer.writeNode(name, node); … … 196 200 } 197 201 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. 201 206 GraphWriter& writeEdge(std::string name, const Edge& edge) { 202 207 edge_writer.writeEdge(name, edge); 203 208 } 204 209 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. 208 214 template <typename Value> 209 215 GraphWriter& writeAttribute(std::string name, const Value& value) { … … 212 218 } 213 219 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. 217 224 template <typename Writer, typename Value> 218 225 GraphWriter& writeAttribute(std::string name, const Value& value, … … 224 231 /// \brief Conversion operator to LemonWriter. 225 232 /// 226 /// Conversion operator to LemonWriter. It make possible233 /// Conversion operator to LemonWriter. It makes possible 227 234 /// to access the encapsulated \e LemonWriter, this way 228 235 /// you can attach to this writer new instances of … … 232 239 } 233 240 234 /// \brief Executes the writ ercommands.235 /// 236 /// Executes the writ ercommands.241 /// \brief Executes the writing commands. 242 /// 243 /// Executes the writing commands. 237 244 void run() { 238 245 writer->run(); … … 242 249 /// 243 250 /// 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 belong sto the node.251 /// named node map then it will write the map value belonging to the node. 245 252 void writeId(std::ostream& os, const Node& item) const { 246 253 nodeset_writer.writeId(os, item); … … 250 257 /// 251 258 /// 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 belong sto the edge.259 /// named edge map then it will write the map value belonging to the edge. 253 260 void writeId(std::ostream& os, const Edge& item) const { 254 261 edgeset_writer.writeId(os, item); … … 374 381 /// 375 382 /// The \c UndirGraphWriter class provides the undir graph output. To write 376 /// a graph you should first give writing commands forthe writer. You can383 /// a graph you should first give writing commands to the writer. You can 377 384 /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap 378 385 /// writing and labeled Node, Edge or UndirEdge writing. … … 417 424 /// 418 425 /// With \c writeNode() and \c writeUndirEdge() functions you can 419 /// point out nodes and undirected edges in the graph. Byexample, you can426 /// designate nodes and undirected edges in the graph. For example, you can 420 427 /// write out the source and target of the graph. 421 428 /// … … 428 435 /// 429 436 /// After you give all write commands you must call the \c run() member 430 /// function, which execute all the writercommands.437 /// function, which executes all the writing commands. 431 438 /// 432 439 /// \code … … 466 473 /// \brief Construct a new UndirGraphWriter. 467 474 /// 468 /// Construct a new UndirGraphWriter. It writes intothe given graph475 /// Construct a new UndirGraphWriter. It writes the given graph 469 476 /// to the given file. 470 477 UndirGraphWriter(const std::string& _filename, const Graph& _graph) … … 478 485 /// \brief Construct a new UndirGraphWriter. 479 486 /// 480 /// Construct a new UndirGraphWriter. It writes intothe given graph487 /// Construct a new UndirGraphWriter. It writes the given graph 481 488 /// to given LemonReader. 482 489 UndirGraphWriter(LemonWriter& _writer, const Graph& _graph) … … 496 503 } 497 504 498 /// \brief Add a new node map writer command forthe writer.499 /// 500 /// Add a new node map writer command forthe 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. 501 508 template <typename Map> 502 509 UndirGraphWriter& writeNodeMap(std::string name, const Map& map) { … … 505 512 } 506 513 507 /// \brief Add a new node map writer command forthe writer.508 /// 509 /// Add a new node map writer command forthe 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. 510 517 template <typename Writer, typename Map> 511 518 UndirGraphWriter& writeNodeMap(std::string name, const Map& map, … … 515 522 } 516 523 517 /// \brief Add a new edge map writer command forthe writer.518 /// 519 /// Add a new edge map writer command forthe 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. 520 527 template <typename Map> 521 528 UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) { … … 524 531 } 525 532 526 /// \brief Add a new edge map writer command forthe writer.527 /// 528 /// Add a new edge map writer command forthe 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. 529 536 template <typename Writer, typename Map> 530 537 UndirGraphWriter& writeEdgeMap(std::string name, const Map& map, … … 534 541 } 535 542 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. 539 547 template <typename Map> 540 548 UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) { … … 543 551 } 544 552 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. 548 557 template <typename Writer, typename Map> 549 558 UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map, … … 553 562 } 554 563 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. 558 568 UndirGraphWriter& writeNode(std::string name, const Node& node) { 559 569 node_writer.writeNode(name, node); … … 561 571 } 562 572 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. 566 577 UndirGraphWriter& writeEdge(std::string name, const Edge& edge) { 567 578 undir_edge_writer.writeEdge(name, edge); 568 579 } 569 580 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. 573 586 UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) { 574 587 undir_edge_writer.writeUndirEdge(name, edge); 575 588 } 576 589 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. 580 594 template <typename Value> 581 595 UndirGraphWriter& writeAttribute(std::string name, const Value& value) { … … 584 598 } 585 599 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. 589 604 template <typename Writer, typename Value> 590 605 UndirGraphWriter& writeAttribute(std::string name, const Value& value, … … 596 611 /// \brief Conversion operator to LemonWriter. 597 612 /// 598 /// Conversion operator to LemonWriter. It make possible613 /// Conversion operator to LemonWriter. It makes possible 599 614 /// to access the encapsulated \e LemonWriter, this way 600 615 /// you can attach to this writer new instances of … … 604 619 } 605 620 606 /// \brief Executes the writ ercommands.607 /// 608 /// Executes the writ ercommands.621 /// \brief Executes the writing commands. 622 /// 623 /// Executes the writing commands. 609 624 void run() { 610 625 writer->run(); … … 614 629 /// 615 630 /// 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 belong sto the node.631 /// named node map then it will write the map value belonging to the node. 617 632 void writeId(std::ostream& os, const Node& item) const { 618 633 nodeset_writer.writeId(os, item); … … 622 637 /// 623 638 /// 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 belong sto the edge.639 /// named edge map then it will write the map value belonging to the edge. 625 640 void writeId(std::ostream& os, const Edge& item) const { 626 641 undir_edgeset_writer.writeId(os, item); … … 630 645 /// 631 646 /// 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 belong sto647 /// an "id" named edge map then it will write the map value belonging to 633 648 /// the edge. 634 649 void writeId(std::ostream& os, const UndirEdge& item) const { … … 652 667 653 668 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. 657 674 /// \param os The output stream. 658 675 /// \param g The graph.
Note: See TracChangeset
for help on using the changeset viewer.