Changeset 768:a5e9303a5511 in lemon0.x for src/work/marci/bipartite_graph_wrapper.h
 Timestamp:
 08/23/04 13:06:00 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1031
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/bipartite_graph_wrapper.h
r762 r768 31 31 template<typename Graph> 32 32 class BipartiteGraphWrapper : public GraphWrapper<Graph> { 33 p rotected:33 public: 34 34 typedef IterableBoolMap< typename Graph::template NodeMap<int> > 35 35 SFalseTTrueMap; 36 protected: 36 37 SFalseTTrueMap* s_false_t_true_map; 37 38 … … 47 48 static const bool S_CLASS; 48 49 static const bool T_CLASS; 50 51 /// This method is to reach the iterable maps of the bipartite graph or 52 /// bipartite graph wrapper. 53 const SFalseTTrueMap& sFalseTTrueMap() const { 54 return *s_false_t_true_map; 55 } 49 56 50 57 //bool S_CLASS; … … 212 219 template<typename Graph> 213 220 class BipartiteGraph : public BipartiteGraphWrapper<Graph> { 214 typedef IterableBoolMap< typename Graph::template NodeMap<int> >215 SFalseTTrueMap;221 // typedef IterableBoolMap< typename Graph::template NodeMap<int> > 222 // SFalseTTrueMap; 216 223 typedef BipartiteGraphWrapper<Graph> Parent; 217 224 protected: 218 225 Graph gr; 219 226 typename Graph::template NodeMap<int> bipartite_map; 220 SFalseTTrueMap s_false_t_true_map;227 typename Parent::SFalseTTrueMap s_false_t_true_map; 221 228 public: 222 229 typedef typename Parent::Node Node; … … 259 266 }; 260 267 261 268 template<typename Graph, typename sIterableMap, typename tIterableMap> 269 class stGraphWrapper; 270 271 /// Easier stuff for bipartite graphs. 262 272 template<typename Graph> 263 class stGraphWrapper; 273 class stBipartiteGraphWrapper : public 274 stGraphWrapper<Graph, typename Graph::SFalseTTrueMap, 275 typename Graph::SFalseTTrueMap> { 276 public: 277 typedef stGraphWrapper<Graph, typename Graph::SFalseTTrueMap, 278 typename Graph::SFalseTTrueMap> Parent; 279 stBipartiteGraphWrapper(Graph& _graph) : 280 Parent(_graph, _graph.sFalseTTrueMap(), _graph.sFalseTTrueMap()) { } 281 }; 264 282 265 283 // template<typename Graph> … … 288 306 /// 289 307 /// \author Marton Makai 290 template<typename Graph >308 template<typename Graph, typename sIterableMap, typename tIterableMap> 291 309 class stGraphWrapper : public GraphWrapper<Graph> { 310 protected: 311 const sIterableMap* s_iterable_map; 312 const tIterableMap* t_iterable_map; 292 313 public: 293 314 class Node; 294 315 friend class Node; 295 316 //GN, int 296 //0 normalis, 1 s, 2 , true, ez az iteralasi sorrend,317 //0 normalis, 1 s, 2 t, ez az iteralasi sorrend, 297 318 //es a vege a false azaz (invalid, 3) 298 319 class NodeIt; … … 335 356 static const bool T_CLASS=true; 336 357 337 stGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) , 338 S_NODE(INVALID, 1), 339 T_NODE(INVALID, 2) { } 358 // \bug not too nice constructor. 359 stGraphWrapper(Graph& _graph, 360 const sIterableMap& _s_iterable_map, 361 const tIterableMap& _t_iterable_map) : 362 GraphWrapper<Graph>(_graph), 363 s_iterable_map(&_s_iterable_map), 364 t_iterable_map(&_t_iterable_map), 365 S_NODE(INVALID, 1), 366 T_NODE(INVALID, 2) { } 340 367 341 368 … … 350 377 protected: 351 378 friend class GraphWrapper<Graph>; 352 friend class stGraphWrapper<Graph >;379 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 353 380 template <typename T> friend class NodeMap; 354 381 friend class Edge; … … 381 408 class NodeIt { 382 409 friend class GraphWrapper<Graph>; 383 friend class stGraphWrapper<Graph >;410 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 384 411 typename Graph::NodeIt n; 385 412 int spec; … … 389 416 n(_n), spec(_spec) { } 390 417 NodeIt(const Invalid& i) : n(i), spec(3) { } 391 NodeIt(const stGraphWrapper<Graph>& _G) : n(*(_G.graph)), spec(0) { 418 NodeIt(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G) 419 : n(*(_G.graph)), spec(0) { 392 420 if (!_G.graph>valid(n)) spec=1; 393 421 } … … 397 425 class Edge : public Graph::Edge { 398 426 friend class GraphWrapper<Graph>; 399 friend class stGraphWrapper<Graph >;427 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 400 428 template <typename T> friend class EdgeMap; 401 429 int spec; … … 430 458 class OutEdgeIt { 431 459 friend class GraphWrapper<Graph>; 432 friend class stGraphWrapper<Graph >;460 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 433 461 typename Graph::OutEdgeIt e; 434 462 int spec; … … 441 469 } 442 470 OutEdgeIt(const Invalid& i) : e(i), spec(3), n(i) { } 443 OutEdgeIt(const stGraphWrapper<Graph>& _G, const Node& _n) { 471 OutEdgeIt(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G, 472 const Node& _n) { 444 473 switch (_n.spec) { 445 474 case 0 : … … 474 503 class InEdgeIt { 475 504 friend class GraphWrapper<Graph>; 476 friend class stGraphWrapper<Graph >;505 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 477 506 typename Graph::InEdgeIt e; 478 507 int spec; … … 485 514 } 486 515 InEdgeIt(const Invalid& i) : e(i), spec(3), n(i) { } 487 InEdgeIt(const stGraphWrapper<Graph>& _G, const Node& _n) { 516 InEdgeIt(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G, 517 const Node& _n) { 488 518 switch (_n.spec) { 489 519 case 0 : … … 518 548 class EdgeIt { 519 549 friend class GraphWrapper<Graph>; 520 friend class stGraphWrapper<Graph >;550 friend class stGraphWrapper<Graph, sIterableMap, tIterableMap>; 521 551 typename Graph::EdgeIt e; 522 552 int spec; … … 528 558 e(_e), spec(_spec), n(_n) { } 529 559 EdgeIt(const Invalid& i) : e(i), spec(3), n(i) { } 530 EdgeIt(const stGraphWrapper<Graph >& _G) :560 EdgeIt(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G) : 531 561 e(*(_G.graph)), spec(0), n(INVALID) { 532 562 if (!_G.graph>valid(e)) { … … 719 749 T s_value, t_value; 720 750 public: 721 NodeMap(const stGraphWrapper<Graph>& _G) : Parent(_G), 722 s_value(), 723 t_value() { } 724 NodeMap(const stGraphWrapper<Graph>& _G, T a) : Parent(_G, a), 725 s_value(a), 726 t_value(a) { } 751 NodeMap(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G) : 752 Parent(_G), 753 s_value(), 754 t_value() { } 755 NodeMap(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G, T a) 756 : Parent(_G, a), 757 s_value(a), 758 t_value(a) { } 727 759 T operator[](const Node& n) const { 728 760 switch (n.spec) { … … 754 786 /// This class is to wrap a nodemap of \c Graph and two variables 755 787 /// storing values for \c S_NODE and \c T_NODE to a nodemap of 756 /// stGraphWrapper<Graph >.788 /// stGraphWrapper<Graph, sIterableMap, tIterableMap>. 757 789 template<typename NM> class NodeMapWrapper { 758 790 public: … … 798 830 typename GraphWrapper<Graph>::template NodeMap<T> node_value; 799 831 public: 800 EdgeMap(const stGraphWrapper<Graph>& _G) : Parent(_G), 801 node_value(_G) { } 802 EdgeMap(const stGraphWrapper<Graph>& _G, T a) : Parent(_G, a), 803 node_value(_G, a) { } 832 EdgeMap(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G) 833 : Parent(_G), 834 node_value(_G) { } 835 EdgeMap(const stGraphWrapper<Graph, sIterableMap, tIterableMap>& _G, T a) 836 : Parent(_G, a), 837 node_value(_G, a) { } 804 838 T operator[](const Edge& e) const { 805 839 switch (e.spec) { … … 830 864 831 865 /// This class is to wrap an edgemap and a nodemap of \c Graph 832 /// to an edgemap of stGraphWrapper<Graph >.866 /// to an edgemap of stGraphWrapper<Graph, sIterableMap, tIterableMap>. 833 867 template<typename EM, typename NM> 834 868 class EdgeMapWrapper {
Note: See TracChangeset
for help on using the changeset viewer.