gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge
0 1 0
merge default
0 files changed with 8 insertions and 8 deletions:
↑ Collapse diff ↑
Show white space 48 line context
... ...
@@ -37,125 +37,125 @@
37 37
  /// \brief Dummy type to make it easier to create invalid iterators.
38 38
  ///
39 39
  /// Dummy type to make it easier to create invalid iterators.
40 40
  /// See \ref INVALID for the usage.
41 41
  struct Invalid {
42 42
  public:
43 43
    bool operator==(Invalid) { return true;  }
44 44
    bool operator!=(Invalid) { return false; }
45 45
    bool operator< (Invalid) { return false; }
46 46
  };
47 47

	
48 48
  /// \brief Invalid iterators.
49 49
  ///
50 50
  /// \ref Invalid is a global type that converts to each iterator
51 51
  /// in such a way that the value of the target iterator will be invalid.
52 52
#ifdef LEMON_ONLY_TEMPLATES
53 53
  const Invalid INVALID = Invalid();
54 54
#else
55 55
  extern const Invalid INVALID;
56 56
#endif
57 57

	
58 58
  /// \addtogroup gutils
59 59
  /// @{
60 60

	
61
  ///Create convenient typedefs for the digraph types and iterators
61
  ///Create convenience typedefs for the digraph types and iterators
62 62

	
63 63
  ///This \c \#define creates convenient type definitions for the following
64 64
  ///types of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
65 65
  ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap,
66 66
  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap.
67 67
  ///
68 68
  ///\note If the graph type is a dependent type, ie. the graph type depend
69 69
  ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS()
70 70
  ///macro.
71 71
#define DIGRAPH_TYPEDEFS(Digraph)                                       \
72 72
  typedef Digraph::Node Node;                                           \
73 73
  typedef Digraph::NodeIt NodeIt;                                       \
74 74
  typedef Digraph::Arc Arc;                                             \
75 75
  typedef Digraph::ArcIt ArcIt;                                         \
76 76
  typedef Digraph::InArcIt InArcIt;                                     \
77 77
  typedef Digraph::OutArcIt OutArcIt;                                   \
78 78
  typedef Digraph::NodeMap<bool> BoolNodeMap;                           \
79 79
  typedef Digraph::NodeMap<int> IntNodeMap;                             \
80 80
  typedef Digraph::NodeMap<double> DoubleNodeMap;                       \
81 81
  typedef Digraph::ArcMap<bool> BoolArcMap;                             \
82 82
  typedef Digraph::ArcMap<int> IntArcMap;                               \
83
  typedef Digraph::ArcMap<double> DoubleArcMap;
83
  typedef Digraph::ArcMap<double> DoubleArcMap
84 84

	
85
  ///Create convenient typedefs for the digraph types and iterators
85
  ///Create convenience typedefs for the digraph types and iterators
86 86

	
87 87
  ///\see DIGRAPH_TYPEDEFS
88 88
  ///
89 89
  ///\note Use this macro, if the graph type is a dependent type,
90 90
  ///ie. the graph type depend on a template parameter.
91 91
#define TEMPLATE_DIGRAPH_TYPEDEFS(Digraph)                              \
92 92
  typedef typename Digraph::Node Node;                                  \
93 93
  typedef typename Digraph::NodeIt NodeIt;                              \
94 94
  typedef typename Digraph::Arc Arc;                                    \
95 95
  typedef typename Digraph::ArcIt ArcIt;                                \
96 96
  typedef typename Digraph::InArcIt InArcIt;                            \
97 97
  typedef typename Digraph::OutArcIt OutArcIt;                          \
98 98
  typedef typename Digraph::template NodeMap<bool> BoolNodeMap;         \
99 99
  typedef typename Digraph::template NodeMap<int> IntNodeMap;           \
100 100
  typedef typename Digraph::template NodeMap<double> DoubleNodeMap;     \
101 101
  typedef typename Digraph::template ArcMap<bool> BoolArcMap;           \
102 102
  typedef typename Digraph::template ArcMap<int> IntArcMap;             \
103
  typedef typename Digraph::template ArcMap<double> DoubleArcMap;
103
  typedef typename Digraph::template ArcMap<double> DoubleArcMap
104 104

	
105
  ///Create convenient typedefs for the graph types and iterators
105
  ///Create convenience typedefs for the graph types and iterators
106 106

	
107 107
  ///This \c \#define creates the same convenient type definitions as defined
108 108
  ///by \ref DIGRAPH_TYPEDEFS(Graph) and six more, namely it creates
109 109
  ///\c Edge, \c EdgeIt, \c IncEdgeIt, \c BoolEdgeMap, \c IntEdgeMap,
110 110
  ///\c DoubleEdgeMap.
111 111
  ///
112 112
  ///\note If the graph type is a dependent type, ie. the graph type depend
113 113
  ///on a template parameter, then use \c TEMPLATE_GRAPH_TYPEDEFS()
114 114
  ///macro.
115 115
#define GRAPH_TYPEDEFS(Graph)                                           \
116 116
  DIGRAPH_TYPEDEFS(Graph);                                              \
117 117
  typedef Graph::Edge Edge;                                             \
118 118
  typedef Graph::EdgeIt EdgeIt;                                         \
119 119
  typedef Graph::IncEdgeIt IncEdgeIt;                                   \
120 120
  typedef Graph::EdgeMap<bool> BoolEdgeMap;                             \
121 121
  typedef Graph::EdgeMap<int> IntEdgeMap;                               \
122
  typedef Graph::EdgeMap<double> DoubleEdgeMap;
122
  typedef Graph::EdgeMap<double> DoubleEdgeMap
123 123

	
124
  ///Create convenient typedefs for the graph types and iterators
124
  ///Create convenience typedefs for the graph types and iterators
125 125

	
126 126
  ///\see GRAPH_TYPEDEFS
127 127
  ///
128 128
  ///\note Use this macro, if the graph type is a dependent type,
129 129
  ///ie. the graph type depend on a template parameter.
130 130
#define TEMPLATE_GRAPH_TYPEDEFS(Graph)                                  \
131 131
  TEMPLATE_DIGRAPH_TYPEDEFS(Graph);                                     \
132 132
  typedef typename Graph::Edge Edge;                                    \
133 133
  typedef typename Graph::EdgeIt EdgeIt;                                \
134 134
  typedef typename Graph::IncEdgeIt IncEdgeIt;                          \
135 135
  typedef typename Graph::template EdgeMap<bool> BoolEdgeMap;           \
136 136
  typedef typename Graph::template EdgeMap<int> IntEdgeMap;             \
137
  typedef typename Graph::template EdgeMap<double> DoubleEdgeMap;
137
  typedef typename Graph::template EdgeMap<double> DoubleEdgeMap
138 138

	
139 139
  /// \brief Function to count the items in a graph.
140 140
  ///
141 141
  /// This function counts the items (nodes, arcs etc.) in a graph.
142 142
  /// The complexity of the function is linear because
143 143
  /// it iterates on all of the items.
144 144
  template <typename Graph, typename Item>
145 145
  inline int countItems(const Graph& g) {
146 146
    typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
147 147
    int num = 0;
148 148
    for (ItemIt it(g); it != INVALID; ++it) {
149 149
      ++num;
150 150
    }
151 151
    return num;
152 152
  }
153 153

	
154 154
  // Node counting:
155 155

	
156 156
  namespace _core_bits {
157 157

	
158 158
    template <typename Graph, typename Enable = void>
159 159
    struct CountNodesSelector {
160 160
      static int count(const Graph &g) {
161 161
        return countItems<Graph, typename Graph::Node>(g);
0 comments (0 inline)