[Lemon-commits] Peter Kovacs: Remove non-checked subgraph adapto...
Lemon HG
hg at lemon.cs.elte.hu
Sun Jan 11 16:18:26 CET 2009
details: http://lemon.cs.elte.hu/hg/lemon/rev/c246659c8b19
changeset: 476:c246659c8b19
user: Peter Kovacs <kpeter [at] inf.elte.hu>
date: Sun Jan 11 15:24:20 2009 +0100
description:
Remove non-checked subgraph adaptors + rename parameters (#67)
diffstat:
2 files changed, 335 insertions(+), 361 deletions(-)
lemon/adaptors.h | 692 ++++++++++++++++-------------------
lemon/bits/graph_adaptor_extender.h | 4
diffs (truncated from 1118 to 300 lines):
diff --git a/lemon/adaptors.h b/lemon/adaptors.h
--- a/lemon/adaptors.h
+++ b/lemon/adaptors.h
@@ -353,22 +353,26 @@
/// It conforms to the \ref concepts::Digraph "Digraph" concept.
///
/// The adapted digraph can also be modified through this adaptor
- /// by adding or removing nodes or arcs, unless the \c _Digraph template
+ /// by adding or removing nodes or arcs, unless the \c GR template
/// parameter is set to be \c const.
///
- /// \tparam _Digraph The type of the adapted digraph.
+ /// \tparam GR The type of the adapted digraph.
/// It must conform to the \ref concepts::Digraph "Digraph" concept.
/// It can also be specified to be \c const.
///
/// \note The \c Node and \c Arc types of this adaptor and the adapted
/// digraph are convertible to each other.
- template<typename _Digraph>
+ template<typename GR>
+#ifdef DOXYGEN
+ class ReverseDigraph {
+#else
class ReverseDigraph :
- public DigraphAdaptorExtender<ReverseDigraphBase<_Digraph> > {
+ public DigraphAdaptorExtender<ReverseDigraphBase<GR> > {
+#endif
public:
- typedef _Digraph Digraph;
- typedef DigraphAdaptorExtender<
- ReverseDigraphBase<_Digraph> > Parent;
+ /// The type of the adapted digraph.
+ typedef GR Digraph;
+ typedef DigraphAdaptorExtender<ReverseDigraphBase<GR> > Parent;
protected:
ReverseDigraph() { }
public:
@@ -386,9 +390,9 @@
/// This function just returns a read-only \ref ReverseDigraph adaptor.
/// \ingroup graph_adaptors
/// \relates ReverseDigraph
- template<typename Digraph>
- ReverseDigraph<const Digraph> reverseDigraph(const Digraph& digraph) {
- return ReverseDigraph<const Digraph>(digraph);
+ template<typename GR>
+ ReverseDigraph<const GR> reverseDigraph(const GR& digraph) {
+ return ReverseDigraph<const GR>(digraph);
}
@@ -696,28 +700,25 @@
/// A \c bool node map and a \c bool arc map must be specified, which
/// define the filters for nodes and arcs.
/// Only the nodes and arcs with \c true filter value are
- /// shown in the subdigraph. This adaptor conforms to the \ref
- /// concepts::Digraph "Digraph" concept. If the \c _checked parameter
- /// is \c true, then the arcs incident to hidden nodes are also
- /// filtered out.
+ /// shown in the subdigraph. The arcs that are incident to hidden
+ /// nodes are also filtered out.
+ /// This adaptor conforms to the \ref concepts::Digraph "Digraph" concept.
///
/// The adapted digraph can also be modified through this adaptor
- /// by adding or removing nodes or arcs, unless the \c _Digraph template
+ /// by adding or removing nodes or arcs, unless the \c GR template
/// parameter is set to be \c const.
///
- /// \tparam _Digraph The type of the adapted digraph.
+ /// \tparam GR The type of the adapted digraph.
/// It must conform to the \ref concepts::Digraph "Digraph" concept.
/// It can also be specified to be \c const.
- /// \tparam _NodeFilterMap A \c bool (or convertible) node map of the
- /// adapted digraph. The default map type is
- /// \ref concepts::Digraph::NodeMap "_Digraph::NodeMap<bool>".
- /// \tparam _ArcFilterMap A \c bool (or convertible) arc map of the
- /// adapted digraph. The default map type is
- /// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap<bool>".
- /// \tparam _checked If this parameter is set to \c false, then the arc
- /// filtering is not checked with respect to the node filter.
- /// Otherwise, each arc that is incident to a hidden node is automatically
- /// filtered out. This is the default option.
+ /// \tparam NF The type of the node filter map.
+ /// It must be a \c bool (or convertible) node map of the
+ /// adapted digraph. The default type is
+ /// \ref concepts::Digraph::NodeMap "GR::NodeMap<bool>".
+ /// \tparam AF The type of the arc filter map.
+ /// It must be \c bool (or convertible) arc map of the
+ /// adapted digraph. The default type is
+ /// \ref concepts::Digraph::ArcMap "GR::ArcMap<bool>".
///
/// \note The \c Node and \c Arc types of this adaptor and the adapted
/// digraph are convertible to each other.
@@ -725,30 +726,25 @@
/// \see FilterNodes
/// \see FilterArcs
#ifdef DOXYGEN
- template<typename _Digraph,
- typename _NodeFilterMap,
- typename _ArcFilterMap,
- bool _checked>
+ template<typename GR, typename NF, typename AF>
+ class SubDigraph {
#else
- template<typename _Digraph,
- typename _NodeFilterMap = typename _Digraph::template NodeMap<bool>,
- typename _ArcFilterMap = typename _Digraph::template ArcMap<bool>,
- bool _checked = true>
+ template<typename GR,
+ typename NF = typename GR::template NodeMap<bool>,
+ typename AF = typename GR::template ArcMap<bool> >
+ class SubDigraph :
+ public DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> > {
#endif
- class SubDigraph
- : public DigraphAdaptorExtender<
- SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> > {
public:
/// The type of the adapted digraph.
- typedef _Digraph Digraph;
+ typedef GR Digraph;
/// The type of the node filter map.
- typedef _NodeFilterMap NodeFilterMap;
+ typedef NF NodeFilterMap;
/// The type of the arc filter map.
- typedef _ArcFilterMap ArcFilterMap;
+ typedef AF ArcFilterMap;
- typedef DigraphAdaptorExtender<
- SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> >
- Parent;
+ typedef DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> >
+ Parent;
typedef typename Parent::Node Node;
typedef typename Parent::Arc Arc;
@@ -827,35 +823,36 @@
/// This function just returns a read-only \ref SubDigraph adaptor.
/// \ingroup graph_adaptors
/// \relates SubDigraph
- template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
- SubDigraph<const Digraph, NodeFilterMap, ArcFilterMap>
- subDigraph(const Digraph& digraph, NodeFilterMap& nfm, ArcFilterMap& afm) {
- return SubDigraph<const Digraph, NodeFilterMap, ArcFilterMap>
- (digraph, nfm, afm);
+ template<typename GR, typename NF, typename AF>
+ SubDigraph<const GR, NF, AF>
+ subDigraph(const GR& digraph,
+ NF& node_filter_map, AF& arc_filter_map) {
+ return SubDigraph<const GR, NF, AF>
+ (digraph, node_filter_map, arc_filter_map);
}
- template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
- SubDigraph<const Digraph, const NodeFilterMap, ArcFilterMap>
- subDigraph(const Digraph& digraph,
- const NodeFilterMap& nfm, ArcFilterMap& afm) {
- return SubDigraph<const Digraph, const NodeFilterMap, ArcFilterMap>
- (digraph, nfm, afm);
+ template<typename GR, typename NF, typename AF>
+ SubDigraph<const GR, const NF, AF>
+ subDigraph(const GR& digraph,
+ const NF& node_filter_map, AF& arc_filter_map) {
+ return SubDigraph<const GR, const NF, AF>
+ (digraph, node_filter_map, arc_filter_map);
}
- template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
- SubDigraph<const Digraph, NodeFilterMap, const ArcFilterMap>
- subDigraph(const Digraph& digraph,
- NodeFilterMap& nfm, const ArcFilterMap& afm) {
- return SubDigraph<const Digraph, NodeFilterMap, const ArcFilterMap>
- (digraph, nfm, afm);
+ template<typename GR, typename NF, typename AF>
+ SubDigraph<const GR, NF, const AF>
+ subDigraph(const GR& digraph,
+ NF& node_filter_map, const AF& arc_filter_map) {
+ return SubDigraph<const GR, NF, const AF>
+ (digraph, node_filter_map, arc_filter_map);
}
- template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
- SubDigraph<const Digraph, const NodeFilterMap, const ArcFilterMap>
- subDigraph(const Digraph& digraph,
- const NodeFilterMap& nfm, const ArcFilterMap& afm) {
- return SubDigraph<const Digraph, const NodeFilterMap,
- const ArcFilterMap>(digraph, nfm, afm);
+ template<typename GR, typename NF, typename AF>
+ SubDigraph<const GR, const NF, const AF>
+ subDigraph(const GR& digraph,
+ const NF& node_filter_map, const AF& arc_filter_map) {
+ return SubDigraph<const GR, const NF, const AF>
+ (digraph, node_filter_map, arc_filter_map);
}
@@ -1292,28 +1289,25 @@
/// A \c bool node map and a \c bool edge map must be specified, which
/// define the filters for nodes and edges.
/// Only the nodes and edges with \c true filter value are
- /// shown in the subgraph. This adaptor conforms to the \ref
- /// concepts::Graph "Graph" concept. If the \c _checked parameter is
- /// \c true, then the edges incident to hidden nodes are also
- /// filtered out.
+ /// shown in the subgraph. The edges that are incident to hidden
+ /// nodes are also filtered out.
+ /// This adaptor conforms to the \ref concepts::Graph "Graph" concept.
///
/// The adapted graph can also be modified through this adaptor
- /// by adding or removing nodes or edges, unless the \c _Graph template
+ /// by adding or removing nodes or edges, unless the \c GR template
/// parameter is set to be \c const.
///
- /// \tparam _Graph The type of the adapted graph.
+ /// \tparam GR The type of the adapted graph.
/// It must conform to the \ref concepts::Graph "Graph" concept.
/// It can also be specified to be \c const.
- /// \tparam _NodeFilterMap A \c bool (or convertible) node map of the
- /// adapted graph. The default map type is
- /// \ref concepts::Graph::NodeMap "_Graph::NodeMap<bool>".
- /// \tparam _EdgeFilterMap A \c bool (or convertible) edge map of the
- /// adapted graph. The default map type is
- /// \ref concepts::Graph::EdgeMap "_Graph::EdgeMap<bool>".
- /// \tparam _checked If this parameter is set to \c false, then the edge
- /// filtering is not checked with respect to the node filter.
- /// Otherwise, each edge that is incident to a hidden node is automatically
- /// filtered out. This is the default option.
+ /// \tparam NF The type of the node filter map.
+ /// It must be a \c bool (or convertible) node map of the
+ /// adapted graph. The default type is
+ /// \ref concepts::Graph::NodeMap "GR::NodeMap<bool>".
+ /// \tparam EF The type of the edge filter map.
+ /// It must be a \c bool (or convertible) edge map of the
+ /// adapted graph. The default type is
+ /// \ref concepts::Graph::EdgeMap "GR::EdgeMap<bool>".
///
/// \note The \c Node, \c Edge and \c Arc types of this adaptor and the
/// adapted graph are convertible to each other.
@@ -1321,29 +1315,25 @@
/// \see FilterNodes
/// \see FilterEdges
#ifdef DOXYGEN
- template<typename _Graph,
- typename _NodeFilterMap,
- typename _EdgeFilterMap,
- bool _checked>
+ template<typename GR, typename NF, typename EF>
+ class SubGraph {
#else
- template<typename _Graph,
- typename _NodeFilterMap = typename _Graph::template NodeMap<bool>,
- typename _EdgeFilterMap = typename _Graph::template EdgeMap<bool>,
- bool _checked = true>
+ template<typename GR,
+ typename NF = typename GR::template NodeMap<bool>,
+ typename EF = typename GR::template EdgeMap<bool> >
+ class SubGraph :
+ public GraphAdaptorExtender<SubGraphBase<GR, NF, EF, true> > {
#endif
- class SubGraph
- : public GraphAdaptorExtender<
- SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > {
public:
/// The type of the adapted graph.
- typedef _Graph Graph;
+ typedef GR Graph;
/// The type of the node filter map.
- typedef _NodeFilterMap NodeFilterMap;
+ typedef NF NodeFilterMap;
/// The type of the edge filter map.
- typedef _EdgeFilterMap EdgeFilterMap;
+ typedef EF EdgeFilterMap;
- typedef GraphAdaptorExtender<
- SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > Parent;
+ typedef GraphAdaptorExtender< SubGraphBase<GR, NF, EF, true> >
+ Parent;
typedef typename Parent::Node Node;
typedef typename Parent::Edge Edge;
@@ -1422,34 +1412,36 @@
/// This function just returns a read-only \ref SubGraph adaptor.
/// \ingroup graph_adaptors
/// \relates SubGraph
- template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
- SubGraph<const Graph, NodeFilterMap, ArcFilterMap>
- subGraph(const Graph& graph, NodeFilterMap& nfm, ArcFilterMap& efm) {
- return SubGraph<const Graph, NodeFilterMap, ArcFilterMap>(graph, nfm, efm);
+ template<typename GR, typename NF, typename EF>
+ SubGraph<const GR, NF, EF>
+ subGraph(const GR& graph,
+ NF& node_filter_map, EF& edge_filter_map) {
+ return SubGraph<const GR, NF, EF>
+ (graph, node_filter_map, edge_filter_map);
}
- template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
- SubGraph<const Graph, const NodeFilterMap, ArcFilterMap>
- subGraph(const Graph& graph,
- const NodeFilterMap& nfm, ArcFilterMap& efm) {
- return SubGraph<const Graph, const NodeFilterMap, ArcFilterMap>
More information about the Lemon-commits
mailing list