42 #ifndef VIGRA_GRAPH_HXX
43 #define VIGRA_GRAPH_HXX
45 #include "metaprogramming.hxx"
46 #include "tinyvector.hxx"
48 #ifdef WITH_BOOST_GRAPH
50 # include <boost/tuple/tuple.hpp>
51 # include <boost/graph/graph_traits.hpp>
52 # include <boost/graph/properties.hpp>
55 namespace boost_graph {
58 using namespace boost;
62 #else // not WITH_BOOST_GRAPH
66 namespace boost_graph {
68 struct no_property {};
72 struct directed_tag { };
73 struct undirected_tag { };
74 struct bidirectional_tag :
public directed_tag { };
77 struct incidence_graph_tag { };
78 struct adjacency_graph_tag { };
79 struct bidirectional_graph_tag :
public incidence_graph_tag { };
80 struct vertex_list_graph_tag { };
81 struct edge_list_graph_tag { };
82 struct adjacency_matrix_tag { };
85 struct allow_parallel_edge_tag { };
86 struct disallow_parallel_edge_tag { };
89 struct readable_property_map_tag { };
90 struct writable_property_map_tag { };
91 struct read_write_property_map_tag
92 :
public readable_property_map_tag,
93 public writable_property_map_tag {};
94 struct lvalue_property_map_tag
95 :
public read_write_property_map_tag {};
97 struct vertex_index_t {};
99 struct edge_property_tag {};
103 template<
class T1,
class T2>
107 tie_adapter(T1 &x, T2 &y)
111 template<
class X,
class Y>
112 tie_adapter & operator=(
const std::pair<X, Y> &pair)
124 template<
class T1,
class T2>
129 return tie_adapter<T1, T2>(t1, t2);
133 template <
typename G>
134 struct graph_traits {
135 typedef typename G::vertex_descriptor vertex_descriptor;
136 typedef typename G::edge_descriptor edge_descriptor;
137 typedef typename G::adjacency_iterator adjacency_iterator;
138 typedef typename G::out_edge_iterator out_edge_iterator;
139 typedef typename G::in_edge_iterator in_edge_iterator;
140 typedef typename G::vertex_iterator vertex_iterator;
141 typedef typename G::edge_iterator edge_iterator;
143 typedef typename G::directed_category directed_category;
144 typedef typename G::edge_parallel_category edge_parallel_category;
145 typedef typename G::traversal_category traversal_category;
147 typedef typename G::vertices_size_type vertices_size_type;
148 typedef typename G::edges_size_type edges_size_type;
149 typedef typename G::degree_size_type degree_size_type;
151 static inline vertex_descriptor null_vertex()
153 return vertex_descriptor(-1);
158 template <
typename PropMap>
159 struct property_traits
161 typedef typename PropMap::key_type key_type;
162 typedef typename PropMap::value_type value_type;
163 typedef typename PropMap::reference reference;
164 typedef typename PropMap::category category;
169 #endif // WITH_BOOST_GRAPH
172 # include <lemon/core.h>
173 #else // not WITH_LEMON
180 bool operator==(Invalid)
const {
return true; }
181 bool operator!=(Invalid)
const {
return false; }
182 bool operator< (Invalid)
const {
return false; }
184 template <
class T,
int N>
191 static const Invalid INVALID = Invalid();
193 typedef vigra::VigraTrueType True;
194 typedef vigra::VigraFalseType False;
205 return t == T(Invalid());
211 return t == T(Invalid());
217 return t != T(Invalid());
223 return t != T(Invalid());
231 template<
class GRAPH,
class ITEM>
232 struct GraphItemHelper;
234 template<
class GRAPH>
235 struct GraphItemHelper<GRAPH,typename GRAPH::Edge>{
236 typedef typename GRAPH::index_type index_type ;
237 typedef typename GRAPH::Edge Item;
238 typedef typename GRAPH::EdgeIt ItemIt;
241 static index_type maxItemId(
const GRAPH & g){
242 return g.maxEdgeId();
244 static index_type itemNum(
const GRAPH & g){
247 static Item itemFromId(
const GRAPH & g,
const index_type
id){
248 return g.edgeFromId(
id);
253 template<
class GRAPH>
254 struct GraphItemHelper<GRAPH,typename GRAPH::Node>{
255 typedef typename GRAPH::index_type index_type ;
256 typedef typename GRAPH::Node Item;
257 typedef typename GRAPH::NodeIt ItemIt;
260 static index_type maxItemId(
const GRAPH & g){
261 return g.maxNodeId();
263 static index_type itemNum(
const GRAPH & g){
266 static Item itemFromId(
const GRAPH & g,
const index_type
id){
267 return g.nodeFromId(
id);
272 template<
class GRAPH>
273 struct GraphItemHelper<GRAPH,typename GRAPH::Arc>{
274 typedef typename GRAPH::index_type index_type ;
275 typedef typename GRAPH::Arc Item;
276 typedef typename GRAPH::ArcIt ItemIt;
279 static index_type maxItemId(
const GRAPH & g){
282 static index_type itemNum(
const GRAPH & g){
285 static Item itemFromId(
const GRAPH & g,
const index_type
id){
286 return g.arcFromId(
id);
294 namespace lemon_graph {
297 using namespace lemon;
301 #endif // VIGRA_GRAPH_HXX
bool operator!=(FFTWComplex< R > const &a, const FFTWComplex< R > &b)
not equal
Definition: fftw3.hxx:841
bool operator==(FFTWComplex< R > const &a, const FFTWComplex< R > &b)
equal
Definition: fftw3.hxx:825
bool operator<(FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
less than
Definition: fixedpoint.hxx:512