summary |
shortlog |
changelog |
graph |
tags |
bookmarks |
branches |
files |
changeset |
file |
latest |
revisions |
annotate |
diff |
comparison |
raw |
help

lemon/nauty_reader.h

changeset 352 | 7c5d8de2eac7 |

parent 351 | 91e68d590e61 |

child 358 | 636fa2f39f10 |

equal
deleted
inserted
replaced

2:520a04fabb46 | 3:8f6cb26453d8 |
---|---|

33 /// |
33 /// |

34 /// \brief Nauty file reader |
34 /// \brief Nauty file reader |

35 /// |
35 /// |

36 /// The \e geng program is in the \e gtools suite of the nauty |
36 /// The \e geng program is in the \e gtools suite of the nauty |

37 /// package. This tool can generate all non-isomorphic undirected |
37 /// package. This tool can generate all non-isomorphic undirected |

38 /// graphs with given node number from several classes (for example, |
38 /// graphs of several classes with given node number (e.g. |

39 /// general, connected, biconnected, triangle-free, 4-cycle-free, |
39 /// general, connected, biconnected, triangle-free, 4-cycle-free, |

40 /// bipartite and graphs with given edge number and degree |
40 /// bipartite and graphs with given edge number and degree |

41 /// constraints). This function reads a \e nauty \e graph6 \e format |
41 /// constraints). This function reads a \e nauty \e graph \e format |

42 /// line from the given stream and builds it in the given graph. |
42 /// line from the given stream and builds it in the given graph. |

43 /// |
43 /// |

44 /// The site of nauty package: http://cs.anu.edu.au/~bdm/nauty/ |
44 /// The site of nauty package: http://cs.anu.edu.au/~bdm/nauty/ |

45 /// |
45 /// |

46 /// For example, the number of all non-isomorphic connected graphs |
46 /// For example, the number of all non-isomorphic planar graphs |

47 /// can be computed with following code. |
47 /// can be computed with the following code. |

48 ///\code |
48 ///\code |

49 /// int num = 0; |
49 /// int num = 0; |

50 /// SmartGraph graph; |
50 /// SmartGraph graph; |

51 /// while (readNauty(graph, std::cin)) { |
51 /// while (readNauty(graph, std::cin)) { |

52 /// PlanarityChecking<SmartGraph> pc(graph); |
52 /// PlanarityChecking<SmartGraph> pc(graph); |

54 /// } |
54 /// } |

55 /// std::cout << "Number of planar graphs: " << num << std::endl; |
55 /// std::cout << "Number of planar graphs: " << num << std::endl; |

56 ///\endcode |
56 ///\endcode |

57 /// |
57 /// |

58 /// The nauty files are quite huge, therefore instead of the direct |
58 /// The nauty files are quite huge, therefore instead of the direct |

59 /// file generation the pipelining is recommended. |
59 /// file generation pipelining is recommended. For example, |

60 ///\code |
60 ///\code |

61 /// ./geng -c 10 | ./num_of_pg |
61 /// ./geng -c 10 | ./num_of_planar_graphs |

62 ///\endcode |
62 ///\endcode |

63 template <typename Graph> |
63 template <typename Graph> |

64 std::istream& readNauty(Graph& graph, std::istream& is) { |
64 std::istream& readNauty(Graph& graph, std::istream& is = std::cin) { |

65 graph.clear(); |
65 graph.clear(); |

66 |
66 |

67 std::string line; |
67 std::string line; |

68 if (getline(is, line)) { |
68 if (getline(is, line)) { |

69 int index = 0; |
69 int index = 0; |