equal
deleted
inserted
replaced
86 |
86 |
87 template<typename Graph> |
87 template<typename Graph> |
88 class GraphWrapper { |
88 class GraphWrapper { |
89 protected: |
89 protected: |
90 Graph* graph; |
90 Graph* graph; |
91 |
91 GraphWrapper() : graph(0) { } |
|
92 void setGraph(Graph& _graph) { graph=&_graph; } |
|
93 |
92 public: |
94 public: |
93 typedef Graph BaseGraph; |
95 typedef Graph BaseGraph; |
94 typedef Graph ParentGraph; |
96 typedef Graph ParentGraph; |
95 |
97 |
96 // GraphWrapper() : graph(0) { } |
|
97 GraphWrapper(Graph& _graph) : graph(&_graph) { } |
98 GraphWrapper(Graph& _graph) : graph(&_graph) { } |
98 // void setGraph(Graph& _graph) { graph=&_graph; } |
|
99 // Graph& getGraph() const { return *graph; } |
99 // Graph& getGraph() const { return *graph; } |
100 |
100 |
101 // typedef typename Graph::Node Node; |
101 // typedef typename Graph::Node Node; |
102 class Node : public Graph::Node { |
102 class Node : public Graph::Node { |
103 friend class GraphWrapper<Graph>; |
103 friend class GraphWrapper<Graph>; |
223 /// A graph wrapper which reverses the orientation of the edges. |
223 /// A graph wrapper which reverses the orientation of the edges. |
224 /// |
224 /// |
225 ///\author Marton Makai |
225 ///\author Marton Makai |
226 template<typename Graph> |
226 template<typename Graph> |
227 class RevGraphWrapper : public GraphWrapper<Graph> { |
227 class RevGraphWrapper : public GraphWrapper<Graph> { |
|
228 protected: |
|
229 RevGraphWrapper() : GraphWrapper<Graph>(0) { } |
228 public: |
230 public: |
229 |
|
230 RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } |
231 RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } |
231 |
232 |
232 typedef typename GraphWrapper<Graph>::Node Node; |
233 typedef typename GraphWrapper<Graph>::Node Node; |
233 typedef typename GraphWrapper<Graph>::Edge Edge; |
234 typedef typename GraphWrapper<Graph>::Edge Edge; |
234 //If Graph::OutEdgeIt is not defined |
235 //If Graph::OutEdgeIt is not defined |
303 typename EdgeFilterMap> |
304 typename EdgeFilterMap> |
304 class SubGraphWrapper : public GraphWrapper<Graph> { |
305 class SubGraphWrapper : public GraphWrapper<Graph> { |
305 protected: |
306 protected: |
306 NodeFilterMap* node_filter_map; |
307 NodeFilterMap* node_filter_map; |
307 EdgeFilterMap* edge_filter_map; |
308 EdgeFilterMap* edge_filter_map; |
|
309 |
|
310 SubGraphWrapper() : GraphWrapper<Graph>(0), |
|
311 node_filter_map(0), edge_filter_map(0) { } |
|
312 void setNodeFilterMap(NodeFilterMap& _node_filter_map) { |
|
313 node_filter_map=&_node_filte_map; |
|
314 } |
|
315 void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) { |
|
316 edge_filter_map=&_edge_filte_map; |
|
317 } |
|
318 |
308 public: |
319 public: |
309 |
320 |
310 SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, |
321 SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, |
311 EdgeFilterMap& _edge_filter_map) : |
322 EdgeFilterMap& _edge_filter_map) : |
312 GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), |
323 GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), |
451 |
462 |
452 /// A wrapper for getting an undirected graph by forgetting |
463 /// A wrapper for getting an undirected graph by forgetting |
453 /// the orientation of a directed one. |
464 /// the orientation of a directed one. |
454 template<typename Graph> |
465 template<typename Graph> |
455 class UndirGraphWrapper : public GraphWrapper<Graph> { |
466 class UndirGraphWrapper : public GraphWrapper<Graph> { |
|
467 protected: |
|
468 UndirGraphWrapper() : GraphWrapper<Graph>(0) { } |
|
469 |
456 public: |
470 public: |
457 typedef typename GraphWrapper<Graph>::Node Node; |
471 typedef typename GraphWrapper<Graph>::Node Node; |
458 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; |
472 typedef typename GraphWrapper<Graph>::NodeIt NodeIt; |
459 typedef typename GraphWrapper<Graph>::Edge Edge; |
473 typedef typename GraphWrapper<Graph>::Edge Edge; |
460 typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt; |
474 typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt; |
534 typename CapacityMap, typename FlowMap> |
548 typename CapacityMap, typename FlowMap> |
535 class ResGraphWrapper : public GraphWrapper<Graph> { |
549 class ResGraphWrapper : public GraphWrapper<Graph> { |
536 protected: |
550 protected: |
537 const CapacityMap* capacity; |
551 const CapacityMap* capacity; |
538 FlowMap* flow; |
552 FlowMap* flow; |
|
553 |
|
554 ResGraphWrapper() : GraphWrapper<Graph>(0), |
|
555 capacity(0), flow(0) { } |
|
556 void setCapacityMap(const CapacityMap& _capacity_map) { |
|
557 capacity_map=&_capacity_map; |
|
558 } |
|
559 void setFlowMap(FlowMap& _flow) { |
|
560 flow=&_flow; |
|
561 } |
|
562 |
539 public: |
563 public: |
540 |
564 |
541 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, |
565 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, |
542 FlowMap& _flow) : |
566 FlowMap& _flow) : |
543 GraphWrapper<Graph>(_graph), capacity(&_capacity), flow(&_flow) { } |
567 GraphWrapper<Graph>(_graph), capacity(&_capacity), flow(&_flow) { } |