| ... | ... |
@@ -46,38 +46,38 @@ |
| 46 | 46 |
/// general, connected, biconnected, triangle-free, 4-cycle-free, |
| 47 | 47 |
/// bipartite and graphs with given edge number and degree |
| 48 | 48 |
/// constraints). This function reads a \e nauty \e graph6 \e format |
| 49 | 49 |
/// line from the given stream and builds it in the given graph. |
| 50 | 50 |
/// |
| 51 | 51 |
/// The site of nauty package: http://cs.anu.edu.au/~bdm/nauty/ |
| 52 | 52 |
/// |
| 53 | 53 |
/// For example, the number of all non-isomorphic connected graphs |
| 54 | 54 |
/// can be computed with following code. |
| 55 | 55 |
///\code |
| 56 | 56 |
/// int num = 0; |
| 57 | 57 |
/// SmartGraph graph; |
| 58 |
/// while(readNauty(std::cin, graph)) {
|
|
| 59 |
/// PlanarityChecking<SmartUGraph> pc(graph); |
|
| 58 |
/// while (readNauty(graph, std::cin)) {
|
|
| 59 |
/// PlanarityChecking<SmartGraph> pc(graph); |
|
| 60 | 60 |
/// if (pc.run()) ++num; |
| 61 | 61 |
/// } |
| 62 | 62 |
/// std::cout << "Number of planar graphs: " << num << std::endl; |
| 63 | 63 |
///\endcode |
| 64 | 64 |
/// |
| 65 | 65 |
/// The nauty files are quite huge, therefore instead of the direct |
| 66 | 66 |
/// file generation the pipelining is recommended. |
| 67 | 67 |
///\code |
| 68 | 68 |
/// ./geng -c 10 | ./num_of_pg |
| 69 | 69 |
///\endcode |
| 70 | 70 |
template <typename Graph> |
| 71 |
std::istream& readNauty(std::istream& is |
|
| 71 |
std::istream& readNauty(Graph& graph, std::istream& is) {
|
|
| 72 | 72 |
graph.clear(); |
| 73 | 73 |
|
| 74 | 74 |
std::string line; |
| 75 | 75 |
if (getline(is, line)) {
|
| 76 | 76 |
int index = 0; |
| 77 | 77 |
|
| 78 | 78 |
int n; |
| 79 | 79 |
|
| 80 | 80 |
if (line[index] == '>') {
|
| 81 | 81 |
index += 10; |
| 82 | 82 |
} |
| 83 | 83 |
|
0 comments (0 inline)