Changeset 2037:32e4bebee616 in lemon-0.x for lemon/graph_adaptor.h
- Timestamp:
- 04/04/06 19:43:23 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2676
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/graph_adaptor.h
r2034 r2037 20 20 #define LEMON_GRAPH_ADAPTOR_H 21 21 22 /// 23 /// 24 /// 22 ///\ingroup graph_adaptors 23 ///\file 24 ///\brief Several graph adaptors. 25 25 /// 26 /// 26 ///This file contains several useful graph adaptor functions. 27 27 /// 28 /// 28 ///\author Marton Makai and Balazs Dezso 29 29 30 30 #include <lemon/bits/invalid.h> … … 75 75 GraphAdaptorBase(Graph& _graph) : graph(&_graph) { } 76 76 77 Graph& getGraph() { return *graph; }78 const Graph& getGraph() const { return *graph; }79 80 77 typedef typename Graph::Node Node; 81 78 typedef typename Graph::Edge Edge; … … 1480 1477 ///\brief An adaptor for composing the residual 1481 1478 ///graph for directed flow and circulation problems. 1479 /// 1482 1480 ///\ingroup graph_adaptors 1483 1481 /// 1484 1482 ///An adaptor for composing the residual graph for 1485 1483 ///directed flow and circulation problems. 1486 ///Let \f$ G=(V, A) \f$ be a directed graph and let \f$ F \f$ be a 1487 ///number type. Let moreover 1488 ///\f$ f,c:A\to F \f$, be functions on the edge-set. 1489 ///In the appications of ResGraphAdaptor, \f$ f \f$ usually stands for a flow 1490 ///and \f$ c \f$ for a capacity function. 1491 ///Suppose that a graph instange \c g of type 1492 ///\c ListGraph implements \f$ G \f$. 1493 ///\code 1494 /// ListGraph g; 1495 ///\endcode 1496 ///Then RevGraphAdaptor implements the graph structure with node-set 1497 ///\f$ V \f$ and edge-set \f$ A_{forward}\cup A_{backward} \f$, where 1498 ///\f$ A_{forward}=\{uv : uv\in A, f(uv)<c(uv)\} \f$ and 1499 ///\f$ A_{backward}=\{vu : uv\in A, f(uv)>0\} \f$, 1500 ///i.e. the so called residual graph. 1501 ///When we take the union \f$ A_{forward}\cup A_{backward} \f$, 1502 ///multilicities are counted, i.e. if an edge is in both 1503 ///\f$ A_{forward} \f$ and \f$ A_{backward} \f$, then in the adaptor it 1504 ///appears twice. 1505 ///The following code shows how 1506 ///such an instance can be constructed. 1507 ///\code 1508 ///typedef ListGraph Graph; 1509 ///Graph::EdgeMap<int> f(g); 1510 ///Graph::EdgeMap<int> c(g); 1511 ///ResGraphAdaptor<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > ga(g); 1512 ///\endcode 1513 ///\author Marton Makai 1514 /// 1484 // ///Let \f$ G=(V, A) \f$ be a directed graph and let \f$ F \f$ be a 1485 // ///number type. Let moreover 1486 // ///\f$ f,c:A\to F \f$, be functions on the edge-set. 1487 // ///In the appications of ResGraphAdaptor, \f$ f \f$ usually stands for a 1488 // ///flow and \f$ c \f$ for a capacity function. 1489 // ///Suppose that a graph instange \c g of type 1490 // ///\c ListGraph implements \f$ G \f$. 1491 // ///\code 1492 // /// ListGraph g; 1493 // ///\endcode 1494 // ///Then RevGraphAdaptor implements the graph structure with node-set 1495 // ///\f$ V \f$ and edge-set \f$ A_{forward}\cup A_{backward} \f$, where 1496 // ///\f$ A_{forward}=\{uv : uv\in A, f(uv)<c(uv)\} \f$ and 1497 // ///\f$ A_{backward}=\{vu : uv\in A, f(uv)>0\} \f$, 1498 // ///i.e. the so called residual graph. 1499 // ///When we take the union \f$ A_{forward}\cup A_{backward} \f$, 1500 // ///multilicities are counted, i.e. if an edge is in both 1501 // ///\f$ A_{forward} \f$ and \f$ A_{backward} \f$, then in the adaptor it 1502 // ///appears twice. The following code shows how such an instance can be 1503 // ///constructed. 1504 // ///\code 1505 // /// typedef ListGraph Graph; 1506 // /// Graph::EdgeMap<int> f(g); 1507 // /// Graph::EdgeMap<int> c(g); 1508 // /// ResGraphAdaptor<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > ga(g); 1509 // ///\endcode 1510 // ///\author Marton Makai 1511 // /// 1515 1512 template<typename Graph, typename Number, 1516 1513 typename CapacityMap, typename FlowMap, … … 1561 1558 1562 1559 public: 1563 1564 const Graph& getGraph() const { return ugraph.getGraph(); }1565 1560 1566 1561 /// \brief Constructor of the residual graph.
Note: See TracChangeset
for help on using the changeset viewer.