0
2
0
... | ... |
@@ -35,46 +35,46 @@ |
35 | 35 |
/// |
36 | 36 |
/// The \e geng program is in the \e gtools suite of the nauty |
37 | 37 |
/// package. This tool can generate all non-isomorphic undirected |
38 | 38 |
/// graphs of several classes with given node number (e.g. |
39 | 39 |
/// general, connected, biconnected, triangle-free, 4-cycle-free, |
40 | 40 |
/// bipartite and graphs with given edge number and degree |
41 | 41 |
/// constraints). This function reads a \e nauty \e graph6 \e format |
42 | 42 |
/// line from the given stream and builds it in the given graph. |
43 | 43 |
/// |
44 | 44 |
/// The site of nauty package: http://cs.anu.edu.au/~bdm/nauty/ |
45 | 45 |
/// |
46 | 46 |
/// For example, the number of all non-isomorphic planar graphs |
47 | 47 |
/// can be computed with the following code. |
48 | 48 |
///\code |
49 | 49 |
/// int num = 0; |
50 | 50 |
/// SmartGraph graph; |
51 |
/// while ( |
|
51 |
/// while (readNautyGraph(graph, std::cin)) { |
|
52 | 52 |
/// PlanarityChecking<SmartGraph> pc(graph); |
53 | 53 |
/// if (pc.run()) ++num; |
54 | 54 |
/// } |
55 | 55 |
/// std::cout << "Number of planar graphs: " << num << std::endl; |
56 | 56 |
///\endcode |
57 | 57 |
/// |
58 | 58 |
/// The nauty files are quite huge, therefore instead of the direct |
59 | 59 |
/// file generation pipelining is recommended. For example, |
60 | 60 |
///\code |
61 | 61 |
/// ./geng -c 10 | ./num_of_planar_graphs |
62 | 62 |
///\endcode |
63 | 63 |
template <typename Graph> |
64 |
std::istream& |
|
64 |
std::istream& readNautyGraph(Graph& graph, std::istream& is = std::cin) { |
|
65 | 65 |
graph.clear(); |
66 | 66 |
|
67 | 67 |
std::string line; |
68 | 68 |
if (getline(is, line)) { |
69 | 69 |
int index = 0; |
70 | 70 |
|
71 | 71 |
int n; |
72 | 72 |
|
73 | 73 |
if (line[index] == '>') { |
74 | 74 |
index += 10; |
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
char c = line[index++]; c -= 63; |
78 | 78 |
if (c != 63) { |
79 | 79 |
n = int(c); |
80 | 80 |
} else { |
... | ... |
@@ -77,19 +77,20 @@ |
77 | 77 |
-e "s/\<DefProcessedMap\>/SetProcessedMap/g"\ |
78 | 78 |
-e "s/\<DefHeap\>/SetHeap/g"\ |
79 | 79 |
-e "s/\<DefStandardHeap\>/SetStandradHeap/g"\ |
80 | 80 |
-e "s/\<DefOperationTraits\>/SetOperationTraits/g"\ |
81 | 81 |
-e "s/\<DefProcessedMapToBeDefaultMap\>/SetStandardProcessedMap/g"\ |
82 | 82 |
-e "s/\<copyGraph\>/graphCopy/g"\ |
83 | 83 |
-e "s/\<copyDigraph\>/digraphCopy/g"\ |
84 | 84 |
-e "s/\<IntegerMap\>/RangeMap/g"\ |
85 | 85 |
-e "s/\<integerMap\>/rangeMap/g"\ |
86 | 86 |
-e "s/\<\([sS]\)tdMap\>/\1parseMap/g"\ |
87 | 87 |
-e "s/\<\([Ff]\)unctorMap\>/\1unctorToMap/g"\ |
88 | 88 |
-e "s/\<\([Mm]\)apFunctor\>/\1apToFunctor/g"\ |
89 | 89 |
-e "s/\<\([Ff]\)orkWriteMap\>/\1orkMap/g"\ |
90 | 90 |
-e "s/\<StoreBoolMap\>/LoggerBoolMap/g"\ |
91 | 91 |
-e "s/\<storeBoolMap\>/loggerBoolMap/g"\ |
92 | 92 |
-e "s/\<BoundingBox\>/Box/g"\ |
93 |
-e "s/\<readNauty\>/readNautyGraph/g"\ |
|
93 | 94 |
<$i > $TMP |
94 | 95 |
mv $TMP $i |
95 | 96 |
done |
0 comments (0 inline)