Removing from work.
1.1 --- a/src/work/deba/graph_reader.h Mon Feb 07 15:40:34 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,674 +0,0 @@
1.4 -/* -*- C++ -*-
1.5 - * src/lemon/graph_reader.h - Part of LEMON, a generic C++ optimization library
1.6 - *
1.7 - * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.8 - * (Egervary Combinatorial Optimization Research Group, EGRES).
1.9 - *
1.10 - * Permission to use, modify and distribute this software is granted
1.11 - * provided that this copyright notice appears in all copies. For
1.12 - * precise terms see the accompanying LICENSE file.
1.13 - *
1.14 - * This software is provided "AS IS" with no warranty of any kind,
1.15 - * express or implied, and with no claim as to its suitability for any
1.16 - * purpose.
1.17 - *
1.18 - */
1.19 -
1.20 -///\ingroup gio
1.21 -///\file
1.22 -///\brief Graph reader.
1.23 -
1.24 -#include <iostream>
1.25 -#include <sstream>
1.26 -
1.27 -#include <map>
1.28 -#include <vector>
1.29 -
1.30 -#include <memory>
1.31 -
1.32 -#include <lemon/error.h>
1.33 -
1.34 -/// \todo fix exceptions
1.35 -
1.36 -
1.37 -namespace lemon {
1.38 -
1.39 - // Exceptions
1.40 -
1.41 - class IOException {
1.42 - public:
1.43 - virtual ~IOException() {}
1.44 - virtual string what() const = 0;
1.45 - };
1.46 -
1.47 - class DataFormatException : public IOException {
1.48 - std::string message;
1.49 - public:
1.50 - DataFormatException(const std::string& _message)
1.51 - : message(_message) {}
1.52 - std::string what() const {
1.53 - return "DataFormatException: " + message;
1.54 - }
1.55 - };
1.56 -
1.57 - template <typename _Exception>
1.58 - class StreamException : public _Exception {
1.59 - public:
1.60 - typedef _Exception Exception;
1.61 - StreamException(int _line, Exception _exception)
1.62 - : Exception(_exception), line_num(_line) {}
1.63 - virtual int line() const {
1.64 - return line_num;
1.65 - }
1.66 -
1.67 - virtual ~StreamException() {}
1.68 -
1.69 - virtual std::string what() const {
1.70 - ostringstream os;
1.71 - os << Exception::what() << " in line " << line();
1.72 - return os.str();
1.73 - }
1.74 - private:
1.75 - int line_num;
1.76 - };
1.77 -
1.78 -
1.79 - /// \brief Standard ReaderTraits for the GraphReader class.
1.80 - ///
1.81 - /// Standard ReaderTraits for the GraphReader class.
1.82 - /// It defines standard reading method for all type of value.
1.83 - struct DefaultReaderTraits {
1.84 -
1.85 - /// \brief Template class for reading an value.
1.86 - ///
1.87 - /// Template class for reading an value.
1.88 - template <typename _Value>
1.89 - struct Reader {
1.90 - /// The value type.
1.91 - typedef _Value Value;
1.92 - /// \brief Reads a value from the given stream.
1.93 - ///
1.94 - /// Reads a value from the given stream.
1.95 - void read(std::istream& is, Value& value) {
1.96 - if (!(is >> value))
1.97 - throw DataFormatException("Default Reader format exception");
1.98 - }
1.99 - };
1.100 -
1.101 - /// The reader class for the not needed maps.
1.102 - typedef Reader<std::string> DefaultReader;
1.103 -
1.104 - };
1.105 -
1.106 - /// \brief Reader class for quoted strings.
1.107 - ///
1.108 - /// Reader class for quoted strings. It can process the escape
1.109 - /// sequences in the string.
1.110 - class QuotedStringReader {
1.111 - public:
1.112 - typedef std::string Value;
1.113 -
1.114 - /// \brief Constructor for the reader.
1.115 - ///
1.116 - /// Constructor for the reader. If the given parameter is true
1.117 - /// the reader processes the escape sequences.
1.118 - QuotedStringReader(bool _escaped = true) : escaped(_escaped) {}
1.119 -
1.120 - /// \brief Reads a quoted string from the given stream.
1.121 - ///
1.122 - /// Reads a quoted string from the given stream.
1.123 - void read(std::istream& is, std::string& value) {
1.124 - char c;
1.125 - value.clear();
1.126 - is >> ws;
1.127 - if (!is.get(c) || c != '\"')
1.128 - throw DataFormatException("Quoted string format");
1.129 - while (is.get(c) && c != '\"') {
1.130 - if (escaped && c == '\\') {
1.131 - value += readEscape(is);
1.132 - } else {
1.133 - value += c;
1.134 - }
1.135 - }
1.136 - if (!is) throw DataFormatException("Quoted string format");
1.137 - }
1.138 -
1.139 - private:
1.140 -
1.141 - static char readEscape(std::istream& is) {
1.142 - char c;
1.143 - switch (is.get(c), c) {
1.144 - case '\\':
1.145 - return '\\';
1.146 - case '\"':
1.147 - return '\"';
1.148 - case '\'':
1.149 - return '\'';
1.150 - case '\?':
1.151 - return '\?';
1.152 - case 'a':
1.153 - return '\a';
1.154 - case 'b':
1.155 - return '\b';
1.156 - case 'f':
1.157 - return '\f';
1.158 - case 'n':
1.159 - return '\n';
1.160 - case 'r':
1.161 - return '\r';
1.162 - case 't':
1.163 - return '\t';
1.164 - case 'v':
1.165 - return '\v';
1.166 - case 'x':
1.167 - {
1.168 - int code;
1.169 - if (!is.get(c) || !isHex(c))
1.170 - throw DataFormatException("Escape format exception");
1.171 - else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
1.172 - else code = code * 16 + valueHex(c);
1.173 - return code;
1.174 - }
1.175 - default:
1.176 - {
1.177 - int code;
1.178 - if (!isOct(c))
1.179 - throw DataFormatException("Escape format exception");
1.180 - else if (code = valueOct(c), !is.get(c) || !isOct(c))
1.181 - is.putback(c);
1.182 - else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c))
1.183 - is.putback(c);
1.184 - else code = code * 8 + valueOct(c);
1.185 - return code;
1.186 - }
1.187 - }
1.188 - }
1.189 -
1.190 - static bool isOct(char c) {
1.191 - return '0' <= c && c <='7';
1.192 - }
1.193 -
1.194 - static int valueOct(char c) {
1.195 - return c - '0';
1.196 - }
1.197 -
1.198 - static bool isHex(char c) {
1.199 - return ('0' <= c && c <= '9') ||
1.200 - ('a' <= c && c <= 'z') ||
1.201 - ('A' <= c && c <= 'Z');
1.202 - }
1.203 -
1.204 - static int valueHex(char c) {
1.205 - if ('0' <= c && c <= '9') return c - '0';
1.206 - if ('a' <= c && c <= 'z') return c - 'a' + 10;
1.207 - return c - 'A' + 10;
1.208 - }
1.209 -
1.210 - bool escaped;
1.211 - };
1.212 -
1.213 - /// \brief The graph reader class.
1.214 - ///
1.215 - /// The reader class for the graph input.
1.216 - /// \see graph-io-page
1.217 - template <typename _Graph, typename _ReaderTraits = DefaultReaderTraits>
1.218 - class GraphReader {
1.219 - public:
1.220 -
1.221 - typedef _Graph Graph;
1.222 - typedef typename Graph::Node Node;
1.223 - typedef typename Graph::Edge Edge;
1.224 -
1.225 - typedef _ReaderTraits ReaderTraits;
1.226 - typedef typename ReaderTraits::DefaultReader DefaultReader;
1.227 -
1.228 - /// \brief Construct a new GraphReader.
1.229 - ///
1.230 - /// Construct a new GraphReader. It reads from the given map,
1.231 - /// it constructs the given map and it use the given reader as the
1.232 - /// default skipper.
1.233 - GraphReader(std::istream& _is, Graph& _graph,
1.234 - const DefaultReader& _reader = DefaultReader())
1.235 - : is(_is), graph(_graph), nodeSkipper(_reader), edgeSkipper(_reader) {}
1.236 -
1.237 - /// \brief Destruct the graph reader.
1.238 - ///
1.239 - /// Destruct the graph reader.
1.240 - ~GraphReader() {
1.241 -
1.242 - for (typename NodeMapReaders::iterator it = node_map_readers.begin();
1.243 - it != node_map_readers.end(); ++it) {
1.244 - delete it->second;
1.245 - }
1.246 -
1.247 - for (typename EdgeMapReaders::iterator it = edge_map_readers.begin();
1.248 - it != edge_map_readers.end(); ++it) {
1.249 - delete it->second;
1.250 - }
1.251 -
1.252 - }
1.253 -
1.254 - /// \brief Add a new node map reader command for the reader.
1.255 - ///
1.256 - /// Add a new node map reader command for the reader.
1.257 - template <typename Map>
1.258 - GraphReader& addNodeMap(std::string name, Map& map) {
1.259 - return addNodeMap<typename ReaderTraits::template
1.260 - Reader<typename Map::Value>, Map>(name, map);
1.261 - }
1.262 -
1.263 - /// \brief Add a new node map reader command for the reader.
1.264 - ///
1.265 - /// Add a new node map reader command for the reader.
1.266 - template <typename Reader, typename Map>
1.267 - GraphReader& addNodeMap(std::string name, Map& map,
1.268 - const Reader& reader = Reader()) {
1.269 - if (node_map_readers.find(name) != node_map_readers.end()) {
1.270 - throw Exception() << "Multiple read rule for node map: " << name;
1.271 - }
1.272 - node_map_readers.insert(
1.273 - make_pair(name, new MapReader<Node, Map, Reader>(map, reader)));
1.274 - return *this;
1.275 - }
1.276 -
1.277 - /// \brief Add a new node map skipper command for the reader.
1.278 - ///
1.279 - /// Add a new node map skipper command for the reader.
1.280 - template <typename Reader>
1.281 - GraphReader& skipNodeMap(std::string name,
1.282 - const Reader& reader = Reader()) {
1.283 - if (node_map_readers.find(name) != node_map_readers.end()) {
1.284 - throw Exception() << "Multiple read rule for node map: " << name;
1.285 - }
1.286 - node_map_readers.insert(
1.287 - make_pair(name, new SkipReader<Node, Reader>(reader)));
1.288 - return *this;
1.289 - }
1.290 -
1.291 - /// \brief Add a new edge map reader command for the reader.
1.292 - ///
1.293 - /// Add a new edge map reader command for the reader.
1.294 - template <typename Map>
1.295 - GraphReader& addEdgeMap(std::string name, Map& map) {
1.296 - return addEdgeMap<typename ReaderTraits::template
1.297 - Reader<typename Map::Value>, Map>(name, map);
1.298 - }
1.299 -
1.300 -
1.301 - /// \brief Add a new edge map reader command for the reader.
1.302 - ///
1.303 - /// Add a new edge map reader command for the reader.
1.304 - template <typename Reader, typename Map>
1.305 - GraphReader& addEdgeMap(std::string name, Map& map,
1.306 - const Reader& reader = Reader()) {
1.307 - if (edge_map_readers.find(name) != edge_map_readers.end()) {
1.308 - throw Exception() << "Multiple read rule for edge map: " << name;
1.309 - }
1.310 - edge_map_readers.insert(
1.311 - make_pair(name, new MapReader<Edge, Map, Reader>(map, reader)));
1.312 - return *this;
1.313 - }
1.314 -
1.315 - /// \brief Add a new edge map skipper command for the reader.
1.316 - ///
1.317 - /// Add a new edge map skipper command for the reader.
1.318 - template <typename Reader>
1.319 - GraphReader& skipEdgeMap(std::string name,
1.320 - const Reader& reader = Reader()) {
1.321 - if (edge_map_readers.find(name) != edge_map_readers.end()) {
1.322 - throw Exception() << "Multiple read rule for edge map: " << name;
1.323 - }
1.324 - edge_map_readers.insert(
1.325 - make_pair(name, new SkipReader<Edge, Reader>(reader)));
1.326 - return *this;
1.327 - }
1.328 -
1.329 - /// \brief Add a new labeled node reader for the reader.
1.330 - ///
1.331 - /// Add a new labeled node reader for the reader.
1.332 - GraphReader& addNode(std::string name, Node& node) {
1.333 - if (node_readers.find(name) != node_readers.end()) {
1.334 - throw Exception() << "Multiple read rule for node";
1.335 - }
1.336 - node_readers.insert(make_pair(name, &node));
1.337 - return *this;
1.338 - }
1.339 -
1.340 - /// \brief Add a new labeled edge reader for the reader.
1.341 - ///
1.342 - /// Add a new labeled edge reader for the reader.
1.343 - GraphReader& addEdge(std::string name, Edge& edge) {
1.344 - if (edge_readers.find(name) != edge_readers.end()) {
1.345 - throw Exception() << "Multiple read rule for edge";
1.346 - }
1.347 - edge_readers.insert(make_pair(name, &edge));
1.348 - return *this;
1.349 - }
1.350 -
1.351 - /// \brief Executes the reader commands.
1.352 - ///
1.353 - /// Executes the reader commands.
1.354 - void run() {
1.355 - int line_num = 0;
1.356 - std::auto_ptr<InverterBase<Node> > nodeInverter;
1.357 - std::auto_ptr<InverterBase<Edge> > edgeInverter;
1.358 - try {
1.359 - std::string line = readNotEmptyLine(is, line_num);
1.360 - if (line.find("@nodeset") == 0) {
1.361 - line = readNodeSet(line_num, nodeInverter);
1.362 - }
1.363 - if (line.find("@edgeset") == 0) {
1.364 - line = readEdgeSet(line_num, edgeInverter, nodeInverter);
1.365 - }
1.366 - if (line.find("@nodes") == 0) {
1.367 - line = readNodes(line_num, nodeInverter);
1.368 - }
1.369 - if (line.find("@edges") == 0) {
1.370 - line = readEdges(line_num, edgeInverter);
1.371 - }
1.372 - if (line.find("@end") != 0) {
1.373 - throw DataFormatException("Invalid control sequence: " + line);
1.374 - }
1.375 - } catch (DataFormatException e) {
1.376 - throw StreamException<DataFormatException>(line_num, e);
1.377 - }
1.378 - }
1.379 -
1.380 - private:
1.381 -
1.382 - template <typename Item> class InverterBase;
1.383 -
1.384 - std::string readNodeSet(int& line_num,
1.385 - auto_ptr<InverterBase<Node> > & nodeInverter) {
1.386 - std::vector<ReaderBase<Node>* > index;
1.387 - {
1.388 - std::string line = readNotEmptyLine(is, line_num);
1.389 - std::string id;
1.390 - std::istringstream ls(line);
1.391 - while (ls >> id) {
1.392 - if (id[0] == '#') break;
1.393 - typename NodeMapReaders::iterator it = node_map_readers.find(id);
1.394 - if (it != node_map_readers.end()) {
1.395 - index.push_back(it->second);
1.396 - node_map_readers.erase(it);
1.397 - } else {
1.398 - index.push_back(&nodeSkipper);
1.399 - }
1.400 - }
1.401 - }
1.402 -
1.403 - if (index.size() == 0) {
1.404 - throw DataFormatException("No node map found");
1.405 - }
1.406 -
1.407 - nodeInverter = auto_ptr<InverterBase<Node> >(index[0]->getInverter());
1.408 - std::string line;
1.409 - while (line = readNotEmptyLine(is, line_num), line[0] != '@') {
1.410 - Node node = graph.addNode();
1.411 - std::istringstream ls(line);
1.412 - nodeInverter->read(ls, node);
1.413 - for (int i = 1; i < (int)index.size(); ++i) {
1.414 - index[i]->read(ls, node);
1.415 - }
1.416 - }
1.417 - return line;
1.418 - }
1.419 -
1.420 - std::string readEdgeSet(int& line_num,
1.421 - auto_ptr<InverterBase<Edge> > & edgeInverter,
1.422 - auto_ptr<InverterBase<Node> > & nodeInverter) {
1.423 - std::vector<ReaderBase<Edge>*> index;
1.424 - {
1.425 - std::string line = readNotEmptyLine(is, line_num);
1.426 - std::string id;
1.427 - std::istringstream ls(line);
1.428 - while (ls >> id) {
1.429 - if (id[0] == '#') break;
1.430 - typename EdgeMapReaders::iterator it = edge_map_readers.find(id);
1.431 - if (it != edge_map_readers.end()) {
1.432 - index.push_back(it->second);
1.433 - edge_map_readers.erase(it);
1.434 - } else {
1.435 - index.push_back(&edgeSkipper);
1.436 - }
1.437 - }
1.438 - }
1.439 -
1.440 - if (index.size() == 0) {
1.441 - throw DataFormatException("No edge map found");
1.442 - }
1.443 -
1.444 - edgeInverter = auto_ptr<InverterBase<Edge> >(index[0]->getInverter());
1.445 - std::string line;
1.446 - while (line = readNotEmptyLine(is, line_num), line[0] != '@') {
1.447 - std::istringstream ls(line);
1.448 - Node source = nodeInverter->read(ls);
1.449 - Node target = nodeInverter->read(ls);
1.450 - Edge edge = graph.addEdge(source, target);
1.451 - edgeInverter->read(ls, edge);
1.452 - for (int i = 1; i < (int)index.size(); ++i) {
1.453 - index[i]->read(ls, edge);
1.454 - }
1.455 - }
1.456 - return line;
1.457 - }
1.458 -
1.459 - std::string readNodes(int& line_num,
1.460 - auto_ptr<InverterBase<Node> >& nodeInverter) {
1.461 - std::string line;
1.462 - while (line = readNotEmptyLine(is, line_num), line[0] != '@') {
1.463 - std::istringstream ls(line);
1.464 - std::string name;
1.465 - ls >> name;
1.466 - typename NodeReaders::iterator it = node_readers.find(name);
1.467 - if (it != node_readers.end()) {
1.468 - *(it -> second) = nodeInverter->read(ls);
1.469 - }
1.470 - }
1.471 - return line;
1.472 - }
1.473 -
1.474 - std::string readEdges(int& line_num,
1.475 - auto_ptr<InverterBase<Edge> >& edgeInverter) {
1.476 - std::string line;
1.477 - while (line = readNotEmptyLine(is, line_num), line[0] != '@') {
1.478 - std::istringstream ls(line);
1.479 - std::string name;
1.480 - ls >> name;
1.481 - typename EdgeReaders::iterator it = edge_readers.find(name);
1.482 - if (it != edge_readers.end()) {
1.483 - *(it -> second) = edgeInverter->read(ls);
1.484 - }
1.485 - }
1.486 - return line;
1.487 - }
1.488 -
1.489 - std::string readNotEmptyLine(std::istream& is, int& line_num) {
1.490 - std::string line;
1.491 - while (++line_num, getline(is, line)) {
1.492 - int vi = line.find_first_not_of(" \t");
1.493 - if (vi != (int)string::npos && line[vi] != '#') {
1.494 - return line.substr(vi);
1.495 - }
1.496 - }
1.497 - throw DataFormatException("End of stream");
1.498 - }
1.499 -
1.500 - // Inverters store and give back the Item from the id,
1.501 - // and may put the ids into a map.
1.502 -
1.503 - template <typename _Item>
1.504 - class InverterBase {
1.505 - public:
1.506 - typedef _Item Item;
1.507 - virtual void read(std::istream&, const Item&) = 0;
1.508 - virtual Item read(std::istream&) = 0;
1.509 - };
1.510 -
1.511 - template <typename _Item, typename _Map, typename _Reader>
1.512 - class MapReaderInverter : public InverterBase<_Item> {
1.513 - public:
1.514 - typedef _Item Item;
1.515 - typedef _Reader Reader;
1.516 - typedef typename Reader::Value Value;
1.517 - typedef _Map Map;
1.518 - typedef std::map<Value, Item> Inverse;
1.519 -
1.520 - Map& map;
1.521 - Reader reader;
1.522 - Inverse inverse;
1.523 -
1.524 - MapReaderInverter(Map& _map, const Reader& _reader)
1.525 - : map(_map), reader(_reader) {}
1.526 -
1.527 - virtual ~MapReaderInverter() {}
1.528 -
1.529 - virtual void read(std::istream& is, const Item& item) {
1.530 - Value value;
1.531 - reader.read(is, value);
1.532 - map.set(item, value);
1.533 - typename Inverse::iterator it = inverse.find(value);
1.534 - if (it == inverse.end()) {
1.535 - inverse.insert(make_pair(value, item));
1.536 - } else {
1.537 - throw DataFormatException("Multiple ID occurence");
1.538 - }
1.539 - }
1.540 -
1.541 - virtual Item read(std::istream& is) {
1.542 - Value value;
1.543 - reader.read(is, value);
1.544 - typename Inverse::const_iterator it = inverse.find(value);
1.545 - if (it != inverse.end()) {
1.546 - return it->second;
1.547 - } else {
1.548 - throw DataFormatException("Invalid ID");
1.549 - }
1.550 - }
1.551 - };
1.552 -
1.553 - template <typename _Item, typename _Reader>
1.554 - class SkipReaderInverter : public InverterBase<_Item> {
1.555 - public:
1.556 - typedef _Item Item;
1.557 - typedef _Reader Reader;
1.558 - typedef typename Reader::Value Value;
1.559 - typedef std::map<Value, Item> Inverse;
1.560 -
1.561 - Reader reader;
1.562 -
1.563 - SkipReaderInverter(const Reader& _reader)
1.564 - : reader(_reader) {}
1.565 -
1.566 - virtual ~SkipReaderInverter() {}
1.567 -
1.568 - virtual void read(std::istream& is, const Item& item) {
1.569 - Value value;
1.570 - reader.read(is, value);
1.571 - typename Inverse::iterator it = inverse.find(value);
1.572 - if (it == inverse.end()) {
1.573 - inverse.insert(make_pair(value, item));
1.574 - } else {
1.575 - throw DataFormatException("Multiple ID occurence");
1.576 - }
1.577 - }
1.578 -
1.579 - virtual Item read(std::istream& is) {
1.580 - Value value;
1.581 - reader.read(is, value);
1.582 - typename Inverse::const_iterator it = inverse.find(value);
1.583 - if (it != inverse.end()) {
1.584 - return it->second;
1.585 - } else {
1.586 - throw DataFormatException("Invalid ID");
1.587 - }
1.588 - }
1.589 - private:
1.590 - Inverse inverse;
1.591 - };
1.592 -
1.593 - // Readers
1.594 -
1.595 - template <typename _Item>
1.596 - class ReaderBase {
1.597 - public:
1.598 - typedef _Item Item;
1.599 -
1.600 - // virtual ~ReaderBase() {}
1.601 -
1.602 - virtual void read(std::istream& is, const Item& item) = 0;
1.603 - virtual InverterBase<_Item>* getInverter() = 0;
1.604 - };
1.605 -
1.606 - template <typename _Item, typename _Map, typename _Reader>
1.607 - class MapReader : public ReaderBase<_Item> {
1.608 - public:
1.609 - typedef _Map Map;
1.610 - typedef _Reader Reader;
1.611 - typedef typename Reader::Value Value;
1.612 - typedef _Item Item;
1.613 -
1.614 - Map& map;
1.615 - Reader reader;
1.616 -
1.617 - MapReader(Map& _map, const Reader& _reader)
1.618 - : map(_map), reader(_reader) {}
1.619 -
1.620 - virtual ~MapReader() {}
1.621 -
1.622 - virtual void read(std::istream& is, const Item& item) {
1.623 - Value value;
1.624 - reader.read(is, value);
1.625 - map.set(item, value);
1.626 - }
1.627 -
1.628 - virtual InverterBase<_Item>* getInverter() {
1.629 - return new MapReaderInverter<Item, Map, Reader>(map, reader);
1.630 - }
1.631 - };
1.632 -
1.633 -
1.634 - template <typename _Item, typename _Reader>
1.635 - class SkipReader : public ReaderBase<_Item> {
1.636 - public:
1.637 - typedef _Reader Reader;
1.638 - typedef typename Reader::Value Value;
1.639 - typedef _Item Item;
1.640 -
1.641 - Reader reader;
1.642 - SkipReader(const Reader& _reader) : reader(_reader) {}
1.643 -
1.644 - virtual ~SkipReader() {}
1.645 -
1.646 - virtual void read(std::istream& is, const Item& item) {
1.647 - Value value;
1.648 - reader.read(is, value);
1.649 - }
1.650 -
1.651 - virtual InverterBase<Item>* getInverter() {
1.652 - return new SkipReaderInverter<Item, Reader>(reader);
1.653 - }
1.654 - };
1.655 -
1.656 -
1.657 - typedef std::map<std::string, ReaderBase<Node>*> NodeMapReaders;
1.658 - NodeMapReaders node_map_readers;
1.659 -
1.660 - typedef std::map<std::string, ReaderBase<Edge>*> EdgeMapReaders;
1.661 - EdgeMapReaders edge_map_readers;
1.662 -
1.663 - typedef std::map<std::string, Node*> NodeReaders;
1.664 - NodeReaders node_readers;
1.665 -
1.666 - typedef std::map<std::string, Edge*> EdgeReaders;
1.667 - EdgeReaders edge_readers;
1.668 -
1.669 - std::istream& is;
1.670 - Graph& graph;
1.671 -
1.672 - SkipReader<Node, DefaultReader> nodeSkipper;
1.673 - SkipReader<Edge, DefaultReader> edgeSkipper;
1.674 -
1.675 - };
1.676 -
1.677 -}
2.1 --- a/src/work/deba/graph_writer.h Mon Feb 07 15:40:34 2005 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,372 +0,0 @@
2.4 -/* -*- C++ -*-
2.5 - * src/lemon/graph_writer.h - Part of LEMON, a generic C++ optimization library
2.6 - *
2.7 - * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
2.8 - * (Egervary Combinatorial Optimization Research Group, EGRES).
2.9 - *
2.10 - * Permission to use, modify and distribute this software is granted
2.11 - * provided that this copyright notice appears in all copies. For
2.12 - * precise terms see the accompanying LICENSE file.
2.13 - *
2.14 - * This software is provided "AS IS" with no warranty of any kind,
2.15 - * express or implied, and with no claim as to its suitability for any
2.16 - * purpose.
2.17 - *
2.18 - */
2.19 -
2.20 -///\ingroup gio
2.21 -///\file
2.22 -///\brief Graph writer.
2.23 -
2.24 -
2.25 -#include <iostream>
2.26 -#include <sstream>
2.27 -
2.28 -#include <map>
2.29 -#include <vector>
2.30 -
2.31 -#include <memory>
2.32 -
2.33 -#include <lemon/invalid.h>
2.34 -#include <lemon/error.h>
2.35 -
2.36 -
2.37 -namespace lemon {
2.38 -
2.39 - /// \brief Standard WriterTraits for the GraphWriter class.
2.40 - ///
2.41 - /// Standard WriterTraits for the GraphWriter class.
2.42 - /// It defines standard writing method for all type of value.
2.43 - struct DefaultWriterTraits {
2.44 -
2.45 - /// \brief Template class for writing an value.
2.46 - ///
2.47 - /// Template class for writing an value.
2.48 - template <typename _Value>
2.49 - struct Writer {
2.50 - /// The value type.
2.51 - typedef _Value Value;
2.52 -
2.53 - /// \brief Writes a value from the given stream.
2.54 - ///
2.55 - /// Writes a value from the given stream.
2.56 - void write(std::ostream& os, const Value& value) {
2.57 - os << value << '\t';
2.58 - }
2.59 - };
2.60 -
2.61 - };
2.62 -
2.63 -
2.64 - /// \brief Writer class for quoted strings.
2.65 - ///
2.66 - /// Writer class for quoted strings. It can process the escape
2.67 - /// sequences in the string.
2.68 - class QuotedStringWriter {
2.69 - public:
2.70 - typedef std::string Value;
2.71 -
2.72 - /// \brief Constructor for the writer.
2.73 - ///
2.74 - /// Constructor for the writer. If the given parameter is true
2.75 - /// the writer creates escape sequences from special characters.
2.76 - QuotedStringWriter(bool _escaped = true) : escaped(_escaped) {}
2.77 -
2.78 - /// \brief Writes a quoted string from the given stream.
2.79 - ///
2.80 - /// Writes a quoted string from the given stream.
2.81 - void write(std::ostream& os, const std::string& value) {
2.82 - os << "\"";
2.83 - if (escaped) {
2.84 - ostringstream ls;
2.85 - for (int i = 0; i < (int)value.size(); ++i) {
2.86 - writeEscape(ls, value[i]);
2.87 - }
2.88 - os << ls.str();
2.89 - } else {
2.90 - os << value;
2.91 - }
2.92 - os << "\"";
2.93 - }
2.94 -
2.95 - private:
2.96 -
2.97 - static void writeEscape(std::ostream& os, char c) {
2.98 - switch (c) {
2.99 - case '\\':
2.100 - os << "\\\\";
2.101 - return;
2.102 - case '\"':
2.103 - os << "\\\"";
2.104 - return;
2.105 - case '\'':
2.106 - os << "\\\'";
2.107 - return;
2.108 - case '\?':
2.109 - os << "\\\?";
2.110 - return;
2.111 - case '\a':
2.112 - os << "\\a";
2.113 - return;
2.114 - case '\b':
2.115 - os << "\\b";
2.116 - return;
2.117 - case '\f':
2.118 - os << "\\f";
2.119 - return;
2.120 - case '\r':
2.121 - os << "\\r";
2.122 - return;
2.123 - case '\n':
2.124 - os << "\\n";
2.125 - return;
2.126 - case '\t':
2.127 - os << "\\t";
2.128 - return;
2.129 - case '\v':
2.130 - os << "\\v";
2.131 - return;
2.132 - default:
2.133 - if (c < 0x20) {
2.134 - os << '\\' << oct << (int)c;
2.135 - } else {
2.136 - os << c;
2.137 - }
2.138 - return;
2.139 - }
2.140 - }
2.141 - private:
2.142 - bool escaped;
2.143 - };
2.144 -
2.145 -
2.146 - /// \brief The graph writer class.
2.147 - ///
2.148 - /// The writer class for the graph output.
2.149 - /// \see graph-io-page
2.150 - template <typename _Graph, typename _WriterTraits = DefaultWriterTraits>
2.151 - class GraphWriter {
2.152 - public:
2.153 -
2.154 - typedef _Graph Graph;
2.155 - typedef typename Graph::Node Node;
2.156 - typedef typename Graph::NodeIt NodeIt;
2.157 - typedef typename Graph::Edge Edge;
2.158 - typedef typename Graph::EdgeIt EdgeIt;
2.159 -
2.160 - typedef _WriterTraits WriterTraits;
2.161 -
2.162 - /// \brief Construct a new GraphWriter.
2.163 - ///
2.164 - /// Construct a new GraphWriter. It writes from the given map,
2.165 - /// it constructs the given map and it use the given writer as the
2.166 - /// default skipper.
2.167 - GraphWriter(std::ostream& _os, Graph& _graph) : os(_os), graph(_graph) {}
2.168 -
2.169 -
2.170 - /// \brief Destruct the graph writer.
2.171 - ///
2.172 - /// Destruct the graph writer.
2.173 - ~GraphWriter() {
2.174 - for (typename NodeMapWriters::iterator it = node_map_writers.begin();
2.175 - it != node_map_writers.end(); ++it) {
2.176 - delete it->second;
2.177 - }
2.178 -
2.179 - for (typename EdgeMapWriters::iterator it = edge_map_writers.begin();
2.180 - it != edge_map_writers.end(); ++it) {
2.181 - delete it->second;
2.182 - }
2.183 -
2.184 - }
2.185 -
2.186 - // Node map rules
2.187 -
2.188 - /// \brief Add a new node map writer command for the writer.
2.189 - ///
2.190 - /// Add a new node map writer command for the writer.
2.191 - template <typename Map>
2.192 - GraphWriter& addNodeMap(std::string name, const Map& map) {
2.193 - return addNodeMap<typename WriterTraits::template Writer<
2.194 - typename Map::Value>, Map>(name, map);
2.195 - }
2.196 -
2.197 - /// \brief Add a new node map writer command for the writer.
2.198 - ///
2.199 - /// Add a new node map writer command for the writer.
2.200 - template <typename Writer, typename Map>
2.201 - GraphWriter& addNodeMap(std::string name, const Map& map,
2.202 - const Writer& writer = Writer()) {
2.203 - node_map_writers.push_back(
2.204 - make_pair(name, new MapWriter<Node, Map, Writer>(map, writer)));
2.205 - return *this;
2.206 - }
2.207 -
2.208 - // Edge map rules
2.209 -
2.210 - /// \brief Add a new edge map writer command for the writer.
2.211 - ///
2.212 - /// Add a new edge map writer command for the writer.
2.213 - template <typename Map>
2.214 - GraphWriter& addEdgeMap(std::string name, const Map& map) {
2.215 - return addEdgeMap<typename WriterTraits::template Writer<
2.216 - typename Map::Value>, Map>(name, map);
2.217 - }
2.218 -
2.219 -
2.220 - /// \brief Add a new edge map writer command for the writer.
2.221 - ///
2.222 - /// Add a new edge map writer command for the writer.
2.223 - template <typename Writer, typename Map>
2.224 - GraphWriter& addEdgeMap(std::string name,
2.225 - const Map& map, const Writer& writer = Writer()) {
2.226 - edge_map_writers.push_back(make_pair(name,
2.227 - new MapWriter<Edge, Map, Writer>(map, writer)));
2.228 - return *this;
2.229 - }
2.230 -
2.231 - /// \brief Add a new labeled node writer for the writer.
2.232 - ///
2.233 - /// Add a new labeled node writer for the writer.
2.234 - GraphWriter& addNode(std::string name, const Node& node) {
2.235 - node_writers.push_back(make_pair(name, node));
2.236 - return *this;
2.237 - }
2.238 -
2.239 - /// \brief Add a new labeled edge writer for the writer.
2.240 - ///
2.241 - /// Add a new labeled edge writer for the writer.
2.242 - GraphWriter& addEdge(std::string name, const Edge& edge) {
2.243 - edge_writers.push_back(make_pair(name, edge));
2.244 - return *this;
2.245 - }
2.246 -
2.247 - /// \brief Executes the writer commands.
2.248 - ///
2.249 - /// Executes the writer commands.
2.250 - void run() {
2.251 - writeNodeSet();
2.252 - writeEdgeSet();
2.253 - writeNodes();
2.254 - writeEdges();
2.255 - os << "@end" << std::endl;
2.256 - }
2.257 -
2.258 - private:
2.259 -
2.260 - void writeNodeSet() {
2.261 - if (node_map_writers.size() == 0) return;
2.262 - os << "@nodeset" << std::endl;
2.263 - for (int i = 0; i < (int)node_map_writers.size(); ++i) {
2.264 - os << node_map_writers[i].first << '\t';
2.265 - }
2.266 - os << std::endl;
2.267 - for (NodeIt it(graph); it != INVALID; ++it) {
2.268 - for (int i = 0; i < (int)node_map_writers.size(); ++i) {
2.269 - node_map_writers[i].second->write(os, it);
2.270 - }
2.271 - os << std::endl;
2.272 - }
2.273 -
2.274 - }
2.275 -
2.276 - void writeEdgeSet() {
2.277 - if (edge_map_writers.size() == 0) return;
2.278 - if (node_map_writers.size() == 0) {
2.279 - throw Exception() << "Missing node id map";
2.280 - }
2.281 - os << "@edgeset" << std::endl;
2.282 - os << "\t\t";
2.283 - for (int i = 0; i < (int)edge_map_writers.size(); ++i) {
2.284 - os << edge_map_writers[i].first << '\t';
2.285 - }
2.286 - os << std::endl;
2.287 - for (EdgeIt it(graph); it != INVALID; ++it) {
2.288 - node_map_writers[0].second->write(os, graph.source(it));
2.289 - node_map_writers[0].second->write(os, graph.target(it));
2.290 - for (int i = 0; i < (int)edge_map_writers.size(); ++i) {
2.291 - edge_map_writers[i].second->write(os, it);
2.292 - }
2.293 - os << std::endl;
2.294 - }
2.295 - }
2.296 -
2.297 - void writeNodes() {
2.298 - if (node_writers.size() == 0) return;
2.299 - if (node_map_writers.size() == 0) {
2.300 - throw Exception() << "Missing node id map";
2.301 - }
2.302 - os << "@nodes" << std::endl;
2.303 - for (int i = 0; i < (int)node_writers.size(); ++i) {
2.304 - os << node_writers[i].first << '\t';
2.305 - node_map_writers[0].second->write(os, node_writers[i].second);
2.306 - os << std::endl;
2.307 - }
2.308 - }
2.309 -
2.310 - void writeEdges() {
2.311 - if (edge_writers.size() == 0) return;
2.312 - if (edge_map_writers.size() == 0) {
2.313 - throw Exception() << "Missing edge id map";
2.314 - }
2.315 - os << "@edges" << std::endl;
2.316 - for (int i = 0; i < (int)edge_writers.size(); ++i) {
2.317 - os << edge_writers[i].first << '\t';
2.318 - edge_map_writers[0].second->write(os, edge_writers[i].second);
2.319 - os << std::endl;
2.320 - }
2.321 - }
2.322 -
2.323 - // Writers
2.324 -
2.325 - template <class _Item>
2.326 - class WriterBase {
2.327 - public:
2.328 - typedef _Item Item;
2.329 - virtual void write(std::ostream&, const Item&) = 0;
2.330 - };
2.331 -
2.332 - template <class _Item, typename _Map, typename _Writer>
2.333 - class MapWriter : public WriterBase<_Item> {
2.334 - public:
2.335 - typedef _Map Map;
2.336 - typedef _Writer Writer;
2.337 - typedef typename Writer::Value Value;
2.338 - typedef _Item Item;
2.339 -
2.340 - const Map& map;
2.341 - Writer writer;
2.342 -
2.343 - MapWriter(const Map& _map, const Writer& _writer)
2.344 - : map(_map), writer(_writer) {}
2.345 -
2.346 -
2.347 - virtual void write(std::ostream& os, const Item& item) {
2.348 - writer.write(os, map[item]);
2.349 - }
2.350 -
2.351 - };
2.352 -
2.353 -
2.354 -
2.355 - typedef std::vector< std::pair<std::string, WriterBase<Node>*> >
2.356 - NodeMapWriters;
2.357 - NodeMapWriters node_map_writers;
2.358 -
2.359 - typedef std::vector< std::pair<std::string, WriterBase<Edge>*> >
2.360 - EdgeMapWriters;
2.361 - EdgeMapWriters edge_map_writers;
2.362 -
2.363 - typedef std::vector<std::pair<std::string, Node> > NodeWriters;
2.364 - NodeWriters node_writers;
2.365 -
2.366 - typedef std::vector<std::pair<std::string, Edge> > EdgeWriters;
2.367 - EdgeWriters edge_writers;
2.368 -
2.369 - std::ostream& os;
2.370 - Graph& graph;
2.371 -
2.372 - };
2.373 -
2.374 -
2.375 -}
3.1 --- a/src/work/deba/map_utils.h Mon Feb 07 15:40:34 2005 +0000
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,276 +0,0 @@
3.4 -/* -*- C++ -*-
3.5 - * src/lemon/map_utils.h - Part of LEMON, a generic C++ optimization library
3.6 - *
3.7 - * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
3.8 - * (Egervary Combinatorial Optimization Research Group, EGRES).
3.9 - *
3.10 - * Permission to use, modify and distribute this software is granted
3.11 - * provided that this copyright notice appears in all copies. For
3.12 - * precise terms see the accompanying LICENSE file.
3.13 - *
3.14 - * This software is provided "AS IS" with no warranty of any kind,
3.15 - * express or implied, and with no claim as to its suitability for any
3.16 - * purpose.
3.17 - *
3.18 - */
3.19 -
3.20 -///\ingroup mutils
3.21 -///\file
3.22 -///\brief Map utilities.
3.23 -
3.24 -#include <map>
3.25 -
3.26 -
3.27 -namespace lemon {
3.28 -
3.29 - /// \addtogroup mutils
3.30 - /// @{
3.31 -
3.32 - /// \brief General inversable map type.
3.33 -
3.34 - /// This type provides simple inversable map functions.
3.35 - /// The InversableMap wraps an arbitrary ReadWriteMap
3.36 - /// and if a key is setted to a new value then store it
3.37 - /// in the inverse map.
3.38 - /// \param _Graph The graph type.
3.39 - /// \param _Map The map to extend with inversable functionality.
3.40 - template <
3.41 - typename _Graph,
3.42 - typename _Map
3.43 - >
3.44 - class InversableMap : protected _Map {
3.45 -
3.46 - public:
3.47 - typedef _Graph Graph;
3.48 -
3.49 - typedef _Map Map;
3.50 - /// The key type of InversableMap (Node, Edge, UndirEdge).
3.51 - typedef typename _Map::Key Key;
3.52 - /// The value type of the InversableMap.
3.53 - typedef typename _Map::Value Value;
3.54 - typedef std::map<Value, Key> InverseMap;
3.55 -
3.56 - typedef typename _Map::ConstReference ConstReference;
3.57 -
3.58 - /// \brief Constructor.
3.59 - ///
3.60 - /// Construct a new InversableMap for the graph.
3.61 - ///
3.62 - InversableMap(const Graph& graph) : Map(graph) {}
3.63 -
3.64 - /// \brief The setter function of the map.
3.65 - ///
3.66 - /// It sets the map and the inverse map to given key-value pair.
3.67 - void set(const Key& key, const Value& val) {
3.68 - Value oldval = Map::operator[](key);
3.69 - typename InverseMap::iterator it = invMap.find(oldval);
3.70 - if (it != invMap.end() && it->second == key) {
3.71 - invMap.erase(it);
3.72 - }
3.73 - invMap.insert(make_pair(val, key));
3.74 - Map::set(key, val);
3.75 - }
3.76 -
3.77 - /// \brief The getter function of the map.
3.78 - ///
3.79 - /// It gives back the value associated with the key.
3.80 - ConstReference operator[](const Key& key) const {
3.81 - return Map::operator[](key);
3.82 - }
3.83 -
3.84 - /// \brief Add a new key to the map.
3.85 - ///
3.86 - /// Add a new key to the map. It is called by the
3.87 - /// \c AlterationNotifier.
3.88 - virtual void add(const Key& key) {
3.89 - Map::add(key);
3.90 - }
3.91 -
3.92 - /// \brief Erase the key from the map.
3.93 - ///
3.94 - /// Erase the key to the map. It is called by the
3.95 - /// \c AlterationNotifier.
3.96 - virtual void erase(const Key& key) {
3.97 - Value val = Map::operator[](key);
3.98 - typename InverseMap::iterator it = invMap.find(val);
3.99 - if (it != invMap.end() && it->second == key) {
3.100 - invMap.erase(it);
3.101 - }
3.102 - Map::erase(key);
3.103 - }
3.104 -
3.105 - /// \brief Clear the keys from the map and inverse map.
3.106 - ///
3.107 - /// Clear the keys from the map and inverse map. It is called by the
3.108 - /// \c AlterationNotifier.
3.109 - virtual void clear() {
3.110 - invMap.clear();
3.111 - Map::clear();
3.112 - }
3.113 -
3.114 - /// \brief It gives back the just readeable inverse map.
3.115 - ///
3.116 - /// It gives back the just readeable inverse map.
3.117 - const InverseMap& inverse() const {
3.118 - return invMap;
3.119 - }
3.120 -
3.121 -
3.122 - private:
3.123 - InverseMap invMap;
3.124 - };
3.125 -
3.126 -
3.127 -
3.128 - /// \brief Provides a mutable, continous and unique descriptor for each
3.129 - /// item in the graph.
3.130 - ///
3.131 - /// The DescriptorMap class provides a mutable, continous and immutable
3.132 - /// mapping for each item in the graph.
3.133 - ///
3.134 - /// \param _Graph The graph class the \c DescriptorMap belongs to.
3.135 - /// \param _Item The Item is the Key of the Map. It may be Node, Edge or
3.136 - /// UndirEdge.
3.137 - /// \param _Map A ReadWriteMap mapping from the item type to integer.
3.138 -
3.139 - template <
3.140 - typename _Graph,
3.141 - typename _Item,
3.142 - typename _Map
3.143 - >
3.144 - class DescriptorMap : protected _Map {
3.145 -
3.146 - typedef _Item Item;
3.147 - typedef _Map Map;
3.148 -
3.149 - public:
3.150 - /// The graph class of DescriptorMap.
3.151 - typedef _Graph Graph;
3.152 -
3.153 - /// The key type of DescriptorMap (Node, Edge, UndirEdge).
3.154 - typedef typename _Map::Key Key;
3.155 - /// The value type of DescriptorMap.
3.156 - typedef typename _Map::Value Value;
3.157 -
3.158 - typedef std::vector<Item> InverseMap;
3.159 -
3.160 - /// \brief Constructor.
3.161 - ///
3.162 - /// Constructor for creating descriptor map.
3.163 - DescriptorMap(const Graph& _graph) : Map(_graph) {
3.164 - build();
3.165 - }
3.166 -
3.167 - /// \brief Add a new key to the map.
3.168 - ///
3.169 - /// Add a new key to the map. It is called by the
3.170 - /// \c AlterationNotifier.
3.171 - virtual void add(const Item& item) {
3.172 - Map::add(item);
3.173 - Map::set(item, invMap.size());
3.174 - invMap.push_back(item);
3.175 - }
3.176 -
3.177 - /// \brief Erase the key from the map.
3.178 - ///
3.179 - /// Erase the key to the map. It is called by the
3.180 - /// \c AlterationNotifier.
3.181 - virtual void erase(const Item& item) {
3.182 - Map::set(invMap.back(), Map::operator[](item));
3.183 - invMap[Map::operator[](item)] = invMap.back();
3.184 - Map::erase(item);
3.185 - }
3.186 -
3.187 - /// \brief Build the unique map.
3.188 - ///
3.189 - /// Build the unique map. It is called by the
3.190 - /// \c AlterationNotifier.
3.191 - virtual void build() {
3.192 - Map::build();
3.193 - Item it;
3.194 - for (getGraph()->first(it); it != INVALID; getGraph()->next(it)) {
3.195 - Map::set(it, invMap.size());
3.196 - invMap.push_back(it);
3.197 - }
3.198 - }
3.199 -
3.200 - /// \brief Clear the keys from the map.
3.201 - ///
3.202 - /// Clear the keys from the map. It is called by the
3.203 - /// \c AlterationNotifier.
3.204 - virtual void clear() {
3.205 - invMap.clear();
3.206 - Map::clear();
3.207 - }
3.208 -
3.209 - /// \brief Gives back the \e descriptor of the item.
3.210 - ///
3.211 - /// Gives back the mutable and unique \e descriptor of the map.
3.212 - int operator[](const Item& item) const {
3.213 - return Map::operator[](item);
3.214 - }
3.215 -
3.216 - /// \brief Gives back the inverse of the map.
3.217 - ///
3.218 - /// Gives back the inverse of the map.
3.219 - const InverseMap inverse() const {
3.220 - return invMap;
3.221 - }
3.222 -
3.223 - private:
3.224 - vector<Item> invMap;
3.225 - };
3.226 -
3.227 - /// Provides an immutable and unique id for each item in the graph.
3.228 -
3.229 - /// The IdMap class provides an unique and immutable mapping for each item
3.230 - /// in the graph.
3.231 - ///
3.232 - template <typename _Graph, typename _Item>
3.233 - class IdMap {
3.234 - public:
3.235 - typedef _Graph Graph;
3.236 - typedef int Value;
3.237 - typedef _Item Item;
3.238 -
3.239 - /// \brief The class represents the inverse of the map.
3.240 - ///
3.241 - /// The class represents the inverse of the map.
3.242 - /// \see inverse()
3.243 - class InverseMap {
3.244 - protected:
3.245 - InverseMap(const Graph& _graph) : graph(_graph) {}
3.246 - public:
3.247 - /// \brief Gives back the given item by its id.
3.248 - ///
3.249 - /// Gives back the given item by its id.
3.250 - ///
3.251 - Item operator[](int id) const { return graph->fromId(id, Item());}
3.252 - private:
3.253 - Graph* graph;
3.254 - };
3.255 -
3.256 - /// \brief Constructor.
3.257 - ///
3.258 - /// Constructor for creating id map.
3.259 - IdMap(const Graph& _graph) : graph(&_graph) {}
3.260 -
3.261 - /// \brief Gives back the \e id of the item.
3.262 - ///
3.263 - /// Gives back the immutable and unique \e id of the map.
3.264 - int operator[](const Item& item) const { return graph->id(item);}
3.265 -
3.266 - /// \brief Gives back the inverse of the map.
3.267 - ///
3.268 - /// Gives back the inverse of the map.
3.269 - InverseMap inverse() const { return InverseMap(*graph);}
3.270 -
3.271 - private:
3.272 - const Graph* graph;
3.273 -
3.274 - };
3.275 -
3.276 -
3.277 -
3.278 -}
3.279 -