equal
deleted
inserted
replaced
34 \code template<typename Graph> class RevGraphAdaptor; \endcode |
34 \code template<typename Graph> class RevGraphAdaptor; \endcode |
35 template class can be used. |
35 template class can be used. |
36 The code looks as follows |
36 The code looks as follows |
37 \code |
37 \code |
38 ListGraph g; |
38 ListGraph g; |
39 RevGraphAdaptor<ListGraph> rgw(g); |
39 RevGraphAdaptor<ListGraph> rga(g); |
40 int result=algorithm(rgw); |
40 int result=algorithm(rga); |
41 \endcode |
41 \endcode |
42 After running the algorithm, the original graph \c g |
42 After running the algorithm, the original graph \c g |
43 is untouched. |
43 is untouched. |
44 This techniques gives rise to an elegant code, and |
44 This techniques gives rise to an elegant code, and |
45 based on stable graph adaptors, complex algorithms can be |
45 based on stable graph adaptors, complex algorithms can be |
56 |
56 |
57 The behavior of graph adaptors can be very different. Some of them keep |
57 The behavior of graph adaptors can be very different. Some of them keep |
58 capabilities of the original graph while in other cases this would be |
58 capabilities of the original graph while in other cases this would be |
59 meaningless. This means that the concepts that they are models of depend |
59 meaningless. This means that the concepts that they are models of depend |
60 on the graph adaptor, and the wrapped graph(s). |
60 on the graph adaptor, and the wrapped graph(s). |
61 If an edge of \c rgw is deleted, this is carried out by |
61 If an edge of \c rga is deleted, this is carried out by |
62 deleting the corresponding edge of \c g, thus the adaptor modifies the |
62 deleting the corresponding edge of \c g, thus the adaptor modifies the |
63 original graph. |
63 original graph. |
64 But for a residual |
64 But for a residual |
65 graph, this operation has no sense. |
65 graph, this operation has no sense. |
66 Let us stand one more example here to simplify your work. |
66 Let us stand one more example here to simplify your work. |
71 This means that in a situation, |
71 This means that in a situation, |
72 when a <tt> const ListGraph& </tt> reference to a graph is given, |
72 when a <tt> const ListGraph& </tt> reference to a graph is given, |
73 then it have to be instantiated with <tt>Graph=const ListGraph</tt>. |
73 then it have to be instantiated with <tt>Graph=const ListGraph</tt>. |
74 \code |
74 \code |
75 int algorithm1(const ListGraph& g) { |
75 int algorithm1(const ListGraph& g) { |
76 RevGraphAdaptor<const ListGraph> rgw(g); |
76 RevGraphAdaptor<const ListGraph> rga(g); |
77 return algorithm2(rgw); |
77 return algorithm2(rga); |
78 } |
78 } |
79 \endcode |
79 \endcode |
80 */ |
80 */ |