gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Swap parameters in readNauty()
0 1 0
default
1 file changed with 3 insertions and 3 deletions:
↑ Collapse diff ↑
Show white space 48 line context
... ...
@@ -34,62 +34,62 @@
34 34
/// \ingroup nauty_group
35 35
/// \file
36 36
/// \brief Nauty file reader.
37 37
namespace lemon {
38 38

	
39 39
  /// \ingroup nauty_group
40 40
  ///
41 41
  /// \brief Nauty file reader
42 42
  ///
43 43
  /// The \e geng program is in the \e gtools suite of the nauty
44 44
  /// package. This tool can generate all non-isomorphic undirected
45 45
  /// graphs with given node number from several classes (for example,
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, Graph& graph) {
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

	
84 84
      char c = line[index++]; c -= 63;
85 85
      if (c != 63) {
86 86
        n = int(c);
87 87
      } else {
88 88
        c = line[index++]; c -= 63;
89 89
        n = (int(c) << 12);
90 90
        c = line[index++]; c -= 63;
91 91
        n |= (int(c) << 6);
92 92
        c = line[index++]; c -= 63;
93 93
        n |= int(c);
94 94
      }
95 95

	
0 comments (0 inline)