1.1 --- a/lemon/graph_utils.h Mon Apr 03 09:24:38 2006 +0000
1.2 +++ b/lemon/graph_utils.h Mon Apr 03 09:45:23 2006 +0000
1.3 @@ -48,8 +48,7 @@
1.4
1.5 ///This \c \#define creates convenience typedefs for the following types
1.6 ///of \c Graph: \c Node, \c NodeIt, \c Edge, \c EdgeIt, \c InEdgeIt,
1.7 - ///\c OutEdgeIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap,
1.8 - ///\c BoolEdgeMap, \c IntEdgeMap, \c DoubleEdgeMap.
1.9 + ///\c OutEdgeIt
1.10 ///\note If \c G it a template parameter, it should be used in this way.
1.11 ///\code
1.12 /// GRAPH_TYPEDEFS(typename G)
1.13 @@ -64,19 +63,12 @@
1.14 typedef Graph:: EdgeIt EdgeIt; \
1.15 typedef Graph:: InEdgeIt InEdgeIt; \
1.16 typedef Graph::OutEdgeIt OutEdgeIt;
1.17 -// typedef Graph::template NodeMap<bool> BoolNodeMap;
1.18 -// typedef Graph::template NodeMap<int> IntNodeMap;
1.19 -// typedef Graph::template NodeMap<double> DoubleNodeMap;
1.20 -// typedef Graph::template EdgeMap<bool> BoolEdgeMap;
1.21 -// typedef Graph::template EdgeMap<int> IntEdgeMap;
1.22 -// typedef Graph::template EdgeMap<double> DoubleEdgeMap;
1.23 -
1.24 +
1.25 ///Creates convenience typedefs for the undirected graph types and iterators
1.26
1.27 ///This \c \#define creates the same convenience typedefs as defined by
1.28 ///\ref GRAPH_TYPEDEFS(Graph) and three more, namely it creates
1.29 ///\c UEdge, \c UEdgeIt, \c IncEdgeIt,
1.30 - ///\c BoolUEdgeMap, \c IntUEdgeMap, \c DoubleUEdgeMap.
1.31 ///
1.32 ///\note If \c G it a template parameter, it should be used in this way.
1.33 ///\code
1.34 @@ -93,8 +85,25 @@
1.35 // typedef Graph::template UEdgeMap<bool> BoolUEdgeMap;
1.36 // typedef Graph::template UEdgeMap<int> IntUEdgeMap;
1.37 // typedef Graph::template UEdgeMap<double> DoubleUEdgeMap;
1.38 -
1.39
1.40 + ///\brief Creates convenience typedefs for the bipartite undirected graph
1.41 + ///types and iterators
1.42 +
1.43 + ///This \c \#define creates the same convenience typedefs as defined by
1.44 + ///\ref UGRAPH_TYPEDEFS(Graph) and two more, namely it creates
1.45 + ///\c ANodeIt, \c BNodeIt,
1.46 + ///
1.47 + ///\note If \c G it a template parameter, it should be used in this way.
1.48 + ///\code
1.49 + /// BPUGRAPH_TYPEDEFS(typename G)
1.50 + ///\endcode
1.51 + ///
1.52 + ///\warning There are no typedefs for the graph maps because of the lack of
1.53 + ///template typedefs in C++.
1.54 +#define BPUGRAPH_TYPEDEFS(Graph) \
1.55 + UGRAPH_TYPEDEFS(Graph) \
1.56 + typedef Graph::ANodeIt ANodeIt; \
1.57 + typedef Graph::BNodeIt BNodeIt;
1.58
1.59 /// \brief Function to count the items in the graph.
1.60 ///
1.61 @@ -430,7 +439,7 @@
1.62 bool b;
1.63 if (u != v) {
1.64 if (e == INVALID) {
1.65 - g.firstInc(e, u, b);
1.66 + g.firstInc(e, b, u);
1.67 } else {
1.68 b = g.source(e) == u;
1.69 g.nextInc(e, b);
1.70 @@ -440,7 +449,7 @@
1.71 }
1.72 } else {
1.73 if (e == INVALID) {
1.74 - g.firstInc(e, u, b);
1.75 + g.firstInc(e, b, u);
1.76 } else {
1.77 b = true;
1.78 g.nextInc(e, b);
1.79 @@ -485,11 +494,11 @@
1.80 /// }
1.81 ///\endcode
1.82 template <typename Graph>
1.83 - inline typename Graph::UEdge findEdge(const Graph &g,
1.84 - typename Graph::Node u,
1.85 - typename Graph::Node v,
1.86 - typename Graph::UEdge prev = INVALID) {
1.87 - return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, prev);
1.88 + inline typename Graph::UEdge findUEdge(const Graph &g,
1.89 + typename Graph::Node u,
1.90 + typename Graph::Node v,
1.91 + typename Graph::UEdge p = INVALID) {
1.92 + return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, p);
1.93 }
1.94
1.95 /// \brief Iterator for iterating on uedges connected the same nodes.