Changeset 1526:8c14aa8f27a2 in lemon-0.x for lemon/graph_writer.h
- Timestamp:
- 06/30/05 18:13:30 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2012
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.