Changeset 393:4535f78639e2 in lemon-0.x for src/work
- Timestamp:
- 04/24/04 17:19:17 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@524
- Location:
- src/work
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/makefile
r392 r393 1 1 INCLUDEDIRS ?= -I../include -I. -I./{marci,jacint,alpar,klao,akos} 2 CXXFLAGS = -g -O 3-W -Wall $(INCLUDEDIRS) -ansi -pedantic2 CXXFLAGS = -g -O0 -W -Wall $(INCLUDEDIRS) -ansi -pedantic 3 3 4 4 BINARIES ?= bin_heap_demo … … 6 6 # Hat, ez elismerem, hogy nagyon ronda, de mukodik minden altalam 7 7 # ismert rendszeren :-) (Misi) 8 CXX := $(shell type -p g++-3.4 || type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)9 #CXX := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)8 #CXX := $(shell type -p g++-3.4 || type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) 9 CXX := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++) 10 10 CC := $(CXX) 11 11 -
src/work/marci/bipartite_graph_wrapper_test.cc
r389 r393 73 73 max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow); 74 74 max_flow_test.augmentOnShortestPath(); 75 max_flow_test.augmentOnShortestPath(); 76 77 std::cout << max_flow_test.flowValue() << std::endl; 75 78 76 79 return 0; -
src/work/marci/graph_wrapper.h
r389 r393 919 919 SFalseTTrueMap; 920 920 SFalseTTrueMap* s_false_t_true_map; 921 921 922 922 public: 923 923 static const bool S_CLASS=false; … … 931 931 typedef typename GraphWrapper<Graph>::Edge Edge; 932 932 //using GraphWrapper<Graph>::EdgeIt; 933 class ClassNodeIt; 934 friend class ClassNodeIt; 935 class OutEdgeIt; 936 friend class OutEdgeIt; 937 class InEdgeIt; 938 friend class InEdgeIt; 933 939 class ClassNodeIt { 940 friend class BipartiteGraphWrapper<Graph>; 941 protected: 934 942 Node n; 935 943 public: … … 964 972 // }; 965 973 class OutEdgeIt { 966 public:967 974 friend class BipartiteGraphWrapper<Graph>; 975 protected: 968 976 typename Graph::OutEdgeIt e; 969 977 public: … … 979 987 }; 980 988 class InEdgeIt { 981 public: 989 friend class BipartiteGraphWrapper<Graph>; 990 protected: 982 991 typename Graph::InEdgeIt e; 983 992 public: … … 995 1004 using GraphWrapper<Graph>::first; 996 1005 ClassNodeIt& first(ClassNodeIt& n, bool _class) const { 997 n= SNodeIt(*this, _class) ; return n; }1006 n=ClassNodeIt(*this, _class) ; return n; } 998 1007 // SNodeIt& first(SNodeIt& n) const { n=SNodeIt(*this); return n; } 999 1008 // TNodeIt& first(TNodeIt& n) const { n=TNodeIt(*this); return n; } … … 1007 1016 using GraphWrapper<Graph>::next; 1008 1017 ClassNodeIt& next(ClassNodeIt& n) const { 1009 this->s_false_t_true_map->next(n ); return n;1018 this->s_false_t_true_map->next(n.n); return n; 1010 1019 } 1011 1020 // SNodeIt& next(SNodeIt& n) const { … … 1320 1329 } 1321 1330 OutEdgeIt& next(OutEdgeIt& i) const { 1331 typename Graph::Node v; 1322 1332 switch (i.spec) { 1323 1333 case 0: //normal edge 1324 t ypename Graph::Node v=this->graph->aNode(i.e);1334 this->graph->aNode(i.e); 1325 1335 this->graph->next(i.e); 1326 1336 if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk … … 1346 1356 } 1347 1357 InEdgeIt& next(InEdgeIt& i) const { 1358 typename Graph::Node v; 1348 1359 switch (i.spec) { 1349 1360 case 0: //normal edge 1350 typename Graph::Nodev=this->graph->aNode(i.e);1361 v=this->graph->aNode(i.e); 1351 1362 this->graph->next(i.e); 1352 1363 if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk … … 1404 1415 Node tail(const Edge& e) const { 1405 1416 switch (e.spec) { 1406 case 0: 1407 return Node(this->graph->tail(e)); 1408 break; 1409 case 1: 1410 return S_NODE; 1411 break; 1412 case 2: 1413 return Node(e.n); 1414 break; 1417 case 0: 1418 return Node(this->graph->tail(e)); 1419 break; 1420 case 1: 1421 return S_NODE; 1422 break; 1423 case 2: 1424 default: 1425 return Node(e.n); 1426 break; 1415 1427 } 1416 1428 } 1417 1429 Node head(const Edge& e) const { 1418 1430 switch (e.spec) { 1419 case 0: 1420 return Node(this->graph->head(e)); 1421 break; 1422 case 1: 1423 return Node(e.n); 1424 break; 1425 case 2: 1426 return T_NODE; 1427 break; 1431 case 0: 1432 return Node(this->graph->head(e)); 1433 break; 1434 case 1: 1435 return Node(e.n); 1436 break; 1437 case 2: 1438 default: 1439 return T_NODE; 1440 break; 1428 1441 } 1429 1442 } … … 1459 1472 T operator[](const Node& n) const { 1460 1473 switch (n.spec) { 1461 case 0: 1462 return (*this)[n]; 1463 break; 1464 case 1: 1465 return s_value; 1466 break; 1467 case 2: 1468 return t_value; 1469 break; 1474 case 0: 1475 return Parent::operator[](n); 1476 break; 1477 case 1: 1478 return s_value; 1479 break; 1480 case 2: 1481 default: 1482 return t_value; 1483 break; 1470 1484 } 1471 1485 } 1472 1486 void set(const Node& n, T t) { 1473 1487 switch (n.spec) { 1474 case 0: 1475 GraphWrapper<Graph>::template NodeMap<T>::set(n, t); 1476 break; 1477 case 1: 1478 s_value=t; 1479 break; 1480 case 2: 1481 t_value=t; 1482 break; 1488 case 0: 1489 GraphWrapper<Graph>::template NodeMap<T>::set(n, t); 1490 break; 1491 case 1: 1492 s_value=t; 1493 break; 1494 case 2: 1495 default: 1496 t_value=t; 1497 break; 1483 1498 } 1484 1499 } … … 1486 1501 1487 1502 template<typename T> class EdgeMap : public GraphWrapper<Graph>::template EdgeMap<T> { 1488 typedef typename Graph ::template NodeMap<T> Parent;1503 typedef typename GraphWrapper<Graph>::template EdgeMap<T> Parent; 1489 1504 typename GraphWrapper<Graph>::template NodeMap<T> node_value; 1490 1505 public: 1491 EdgeMap(const stGraphWrapper<Graph>& _G) : 1492 1506 EdgeMap(const stGraphWrapper<Graph>& _G) : Parent(_G), 1507 node_value(_G) { } 1493 1508 EdgeMap(const stGraphWrapper<Graph>& _G, T a) : Parent(_G, a), 1494 1509 node_value(_G, a) { } 1495 1510 T operator[](const Edge& e) const { 1496 1511 switch (e.spec) { 1497 case 0: 1498 return (*this)[e]; 1499 break; 1500 case 1: 1501 return node_value[e.n]; 1502 break; 1503 case 2: 1504 return node_value[e.n]; 1505 break; 1512 case 0: 1513 return Parent::operator[](e); 1514 break; 1515 case 1: 1516 return node_value[e.n]; 1517 break; 1518 case 2: 1519 default: 1520 return node_value[e.n]; 1521 break; 1506 1522 } 1507 1523 } 1508 1524 void set(const Edge& e, T t) { 1509 1525 switch (e.spec) { 1510 case 0: 1511 GraphWrapper<Graph>::set(e, t); 1512 break; 1513 case 1: 1514 node_value.set(e, t); 1515 break; 1516 case 2: 1517 node_value.set(e, t); 1518 break; 1526 case 0: 1527 GraphWrapper<Graph>::template EdgeMap<T>::set(e, t); 1528 break; 1529 case 1: 1530 node_value.set(e.n, t); 1531 break; 1532 case 2: 1533 default: 1534 node_value.set(e.n, t); 1535 break; 1519 1536 } 1520 1537 }
Note: See TracChangeset
for help on using the changeset viewer.