0
2
0
... | ... |
@@ -455,42 +455,49 @@ |
455 | 455 |
|
456 | 456 |
/** |
457 | 457 |
@defgroup io_group Input-Output |
458 | 458 |
\brief Graph Input-Output methods |
459 | 459 |
|
460 | 460 |
This group describes the tools for importing and exporting graphs |
461 | 461 |
and graph related data. Now it supports the \ref lgf-format |
462 | 462 |
"LEMON Graph Format", the \c DIMACS format and the encapsulated |
463 | 463 |
postscript (EPS) format. |
464 | 464 |
*/ |
465 | 465 |
|
466 | 466 |
/** |
467 |
@defgroup lemon_io LEMON |
|
467 |
@defgroup lemon_io LEMON Graph Format |
|
468 | 468 |
@ingroup io_group |
469 | 469 |
\brief Reading and writing LEMON Graph Format. |
470 | 470 |
|
471 | 471 |
This group describes methods for reading and writing |
472 | 472 |
\ref lgf-format "LEMON Graph Format". |
473 | 473 |
*/ |
474 | 474 |
|
475 | 475 |
/** |
476 | 476 |
@defgroup eps_io Postscript Exporting |
477 | 477 |
@ingroup io_group |
478 | 478 |
\brief General \c EPS drawer and graph exporter |
479 | 479 |
|
480 | 480 |
This group describes general \c EPS drawing methods and special |
481 | 481 |
graph exporting tools. |
482 | 482 |
*/ |
483 | 483 |
|
484 | 484 |
/** |
485 |
@defgroup nauty_group NAUTY Format |
|
486 |
@ingroup io_group |
|
487 |
\brief Read \e Nauty format |
|
488 |
Tool to read graphs from \e Nauty format data. |
|
489 |
*/ |
|
490 |
|
|
491 |
/** |
|
485 | 492 |
@defgroup concept Concepts |
486 | 493 |
\brief Skeleton classes and concept checking classes |
487 | 494 |
|
488 | 495 |
This group describes the data/algorithm skeletons and concept checking |
489 | 496 |
classes implemented in LEMON. |
490 | 497 |
|
491 | 498 |
The purpose of the classes in this group is fourfold. |
492 | 499 |
|
493 | 500 |
- These classes contain the documentations of the %concepts. In order |
494 | 501 |
to avoid document multiplications, an implementation of a concept |
495 | 502 |
simply refers to the corresponding concept class. |
496 | 503 |
... | ... |
@@ -14,70 +14,63 @@ |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_NAUTY_READER_H |
20 | 20 |
#define LEMON_NAUTY_READER_H |
21 | 21 |
|
22 | 22 |
#include <vector> |
23 | 23 |
#include <iostream> |
24 | 24 |
#include <string> |
25 | 25 |
|
26 |
/// \ingroup io_group |
|
27 |
/// |
|
28 |
/// @defgroup nauty_group NAUTY format |
|
29 |
/// |
|
30 |
/// \brief Read \e Nauty format |
|
31 |
/// |
|
32 |
/// Tool to read graphs from \e Nauty format data |
|
33 |
|
|
34 | 26 |
/// \ingroup nauty_group |
35 | 27 |
/// \file |
36 | 28 |
/// \brief Nauty file reader. |
29 |
|
|
37 | 30 |
namespace lemon { |
38 | 31 |
|
39 | 32 |
/// \ingroup nauty_group |
40 | 33 |
/// |
41 | 34 |
/// \brief Nauty file reader |
42 | 35 |
/// |
43 | 36 |
/// The \e geng program is in the \e gtools suite of the nauty |
44 | 37 |
/// package. This tool can generate all non-isomorphic undirected |
45 |
/// graphs with given node number |
|
38 |
/// graphs of several classes with given node number (e.g. |
|
46 | 39 |
/// general, connected, biconnected, triangle-free, 4-cycle-free, |
47 | 40 |
/// bipartite and graphs with given edge number and degree |
48 |
/// constraints). This function reads a \e nauty \e |
|
41 |
/// constraints). This function reads a \e nauty \e graph \e format |
|
49 | 42 |
/// line from the given stream and builds it in the given graph. |
50 | 43 |
/// |
51 | 44 |
/// The site of nauty package: http://cs.anu.edu.au/~bdm/nauty/ |
52 | 45 |
/// |
53 |
/// For example, the number of all non-isomorphic connected graphs |
|
54 |
/// can be computed with following code. |
|
46 |
/// For example, the number of all non-isomorphic planar graphs |
|
47 |
/// can be computed with the following code. |
|
55 | 48 |
///\code |
56 | 49 |
/// int num = 0; |
57 | 50 |
/// SmartGraph graph; |
58 | 51 |
/// while (readNauty(graph, std::cin)) { |
59 | 52 |
/// PlanarityChecking<SmartGraph> pc(graph); |
60 | 53 |
/// if (pc.run()) ++num; |
61 | 54 |
/// } |
62 | 55 |
/// std::cout << "Number of planar graphs: " << num << std::endl; |
63 | 56 |
///\endcode |
64 | 57 |
/// |
65 | 58 |
/// The nauty files are quite huge, therefore instead of the direct |
66 |
/// file generation |
|
59 |
/// file generation pipelining is recommended. For example, |
|
67 | 60 |
///\code |
68 |
/// ./geng -c 10 | ./ |
|
61 |
/// ./geng -c 10 | ./num_of_planar_graphs |
|
69 | 62 |
///\endcode |
70 | 63 |
template <typename Graph> |
71 |
std::istream& readNauty(Graph& graph, std::istream& is) { |
|
64 |
std::istream& readNauty(Graph& graph, std::istream& is = std::cin) { |
|
72 | 65 |
graph.clear(); |
73 | 66 |
|
74 | 67 |
std::string line; |
75 | 68 |
if (getline(is, line)) { |
76 | 69 |
int index = 0; |
77 | 70 |
|
78 | 71 |
int n; |
79 | 72 |
|
80 | 73 |
if (line[index] == '>') { |
81 | 74 |
index += 10; |
82 | 75 |
} |
83 | 76 |
|
0 comments (0 inline)