Changeset 838:51dcd224455c in lemon-0.x for src/hugo/graph_wrapper.h
- Timestamp:
- 09/13/04 18:15:12 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1137
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/graph_wrapper.h
r792 r838 332 332 333 333 /// This wrapper shows a graph with filtered node-set and 334 /// edge-set. The quick brown fox iterator jumps over 335 /// the lazy dog nodes or edges if the values for them are false 336 /// in the bool maps. 334 /// edge-set. Given a bool-valued map on the node-set and one on 335 /// the edge-set of the graphs, the iterators shows only the objects 336 /// having true value. 337 /// The quick brown fox iterators jump over 338 /// the lazy dog nodes or edges if their values for are false in the 339 /// corresponding bool maps. 337 340 /// 338 341 ///\author Marton Makai … … 545 548 546 549 547 /// \brief A wrapper for forgetting the orientation of a graph. 548 /// 549 /// A wrapper for getting an undirected graph by forgetting 550 /// the orientation of a directed one. 551 /// 552 /// \author Marton Makai 550 // /// \brief A wrapper for forgetting the orientation of a graph. 551 // /// 552 // /// A wrapper for getting an undirected graph by forgetting 553 // /// the orientation of a directed one. 554 // /// 555 // /// \author Marton Makai 556 // /// does not work in the new concept. 553 557 template<typename Graph> 554 558 class UndirGraphWrapper : public GraphWrapper<Graph> { … … 1119 1123 1120 1124 1121 1122 // this is a direct implementation of the bidirected-graph wrapper.1123 // in early hugo, it was implemented that way.1124 template<typename Graph>1125 class OldBidirGraphWrapper : public GraphWrapper<Graph> {1126 public:1127 typedef GraphWrapper<Graph> Parent;1128 protected:1129 OldBidirGraphWrapper() : GraphWrapper<Graph>() { }1130 1131 public:1132 1133 OldBidirGraphWrapper(Graph& _graph) :1134 GraphWrapper<Graph>(_graph) { }1135 1136 class Edge;1137 class OutEdgeIt;1138 friend class Edge;1139 friend class OutEdgeIt;1140 1141 //template<typename T> class NodeMap;1142 template<typename T> class EdgeMap;1143 1144 typedef typename GraphWrapper<Graph>::Node Node;1145 typedef typename GraphWrapper<Graph>::NodeIt NodeIt;1146 1147 class Edge : public Graph::Edge {1148 friend class OldBidirGraphWrapper<Graph>;1149 ///\bug ez nem is kell1150 //template<typename T> friend class NodeMap;1151 template<typename T> friend class EdgeMap;1152 protected:1153 bool backward; //true, iff backward1154 // typename Graph::Edge e;1155 public:1156 Edge() { }1157 ///\bug =false kell-e? zsoltnak kell az addEdge miatt1158 Edge(const typename Graph::Edge& _e, bool _backward=false) :1159 Graph::Edge(_e), backward(_backward) { }1160 Edge(const Invalid& i) : Graph::Edge(i), backward(true) { }1161 //the unique invalid iterator1162 friend bool operator==(const Edge& u, const Edge& v) {1163 return (v.backward==u.backward &&1164 static_cast<typename Graph::Edge>(u)==1165 static_cast<typename Graph::Edge>(v));1166 }1167 friend bool operator!=(const Edge& u, const Edge& v) {1168 return (v.backward!=u.backward ||1169 static_cast<typename Graph::Edge>(u)!=1170 static_cast<typename Graph::Edge>(v));1171 }1172 };1173 1174 class OutEdgeIt {1175 friend class OldBidirGraphWrapper<Graph>;1176 protected:1177 typename Graph::OutEdgeIt out;1178 typename Graph::InEdgeIt in;1179 bool backward;1180 public:1181 OutEdgeIt() { }1182 //FIXME1183 // OutEdgeIt(const Edge& e) : Edge(e) { }1184 OutEdgeIt(const Invalid& i) : out(i), in(i), backward(true) { }1185 //the unique invalid iterator1186 OutEdgeIt(const OldBidirGraphWrapper<Graph>& _G, Node v) {1187 backward=false;1188 _G.graph->first(out, v);1189 while(_G.graph->valid(out) && !_G.enabled(*this)) { _G.graph->next(out); }1190 if (!_G.graph->valid(out)) {1191 backward=true;1192 _G.graph->first(in, v);1193 while(_G.graph->valid(in) && !_G.enabled(*this)) { _G.graph->next(in); }1194 }1195 }1196 operator Edge() const {1197 // Edge e;1198 // e.forward=this->forward;1199 // if (this->forward) e=out; else e=in;1200 // return e;1201 if (this->backward)1202 return Edge(in, this->backward);1203 else1204 return Edge(out, this->backward);1205 }1206 };1207 1208 class InEdgeIt {1209 friend class OldBidirGraphWrapper<Graph>;1210 protected:1211 typename Graph::OutEdgeIt out;1212 typename Graph::InEdgeIt in;1213 bool backward;1214 public:1215 InEdgeIt() { }1216 //FIXME1217 // OutEdgeIt(const Edge& e) : Edge(e) { }1218 InEdgeIt(const Invalid& i) : out(i), in(i), backward(true) { }1219 //the unique invalid iterator1220 InEdgeIt(const OldBidirGraphWrapper<Graph>& _G, Node v) {1221 backward=false;1222 _G.graph->first(in, v);1223 while(_G.graph->valid(in) && !_G.enabled(*this)) { _G.graph->next(in); }1224 if (!_G.graph->valid(in)) {1225 backward=true;1226 _G.graph->first(out, v);1227 while(_G.graph->valid(out) && !_G.enabled(*this)) { _G.graph->next(out); }1228 }1229 }1230 operator Edge() const {1231 // Edge e;1232 // e.forward=this->forward;1233 // if (this->forward) e=out; else e=in;1234 // return e;1235 if (this->backward)1236 return Edge(out, this->backward);1237 else1238 return Edge(in, this->backward);1239 }1240 };1241 1242 class EdgeIt {1243 friend class OldBidirGraphWrapper<Graph>;1244 protected:1245 typename Graph::EdgeIt e;1246 bool backward;1247 public:1248 EdgeIt() { }1249 EdgeIt(const Invalid& i) : e(i), backward(true) { }1250 EdgeIt(const OldBidirGraphWrapper<Graph>& _G) {1251 backward=false;1252 _G.graph->first(e);1253 while (_G.graph->valid(e) && !_G.enabled(*this)) _G.graph->next(e);1254 if (!_G.graph->valid(e)) {1255 backward=true;1256 _G.graph->first(e);1257 while (_G.graph->valid(e) && !_G.enabled(*this)) _G.graph->next(e);1258 }1259 }1260 operator Edge() const {1261 return Edge(e, this->backward);1262 }1263 };1264 1265 using GraphWrapper<Graph>::first;1266 // NodeIt& first(NodeIt& i) const {1267 // i=NodeIt(*this); return i;1268 // }1269 OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {1270 i=OutEdgeIt(*this, p); return i;1271 }1272 // FIXME not tested1273 InEdgeIt& first(InEdgeIt& i, const Node& p) const {1274 i=InEdgeIt(*this, p); return i;1275 }1276 EdgeIt& first(EdgeIt& i) const {1277 i=EdgeIt(*this); return i;1278 }1279 1280 using GraphWrapper<Graph>::next;1281 // NodeIt& next(NodeIt& n) const { GraphWrapper<Graph>::next(n); return n; }1282 OutEdgeIt& next(OutEdgeIt& e) const {1283 if (!e.backward) {1284 Node v=this->graph->aNode(e.out);1285 this->graph->next(e.out);1286 while(this->graph->valid(e.out) && !enabled(e)) {1287 this->graph->next(e.out); }1288 if (!this->graph->valid(e.out)) {1289 e.backward=true;1290 this->graph->first(e.in, v);1291 while(this->graph->valid(e.in) && !enabled(e)) {1292 this->graph->next(e.in); }1293 }1294 } else {1295 this->graph->next(e.in);1296 while(this->graph->valid(e.in) && !enabled(e)) {1297 this->graph->next(e.in); }1298 }1299 return e;1300 }1301 // FIXME Not tested1302 InEdgeIt& next(InEdgeIt& e) const {1303 if (!e.backward) {1304 Node v=this->graph->aNode(e.in);1305 this->graph->next(e.in);1306 while(this->graph->valid(e.in) && !enabled(e)) {1307 this->graph->next(e.in); }1308 if (!this->graph->valid(e.in)) {1309 e.backward=true;1310 this->graph->first(e.out, v);1311 while(this->graph->valid(e.out) && !enabled(e)) {1312 this->graph->next(e.out); }1313 }1314 } else {1315 this->graph->next(e.out);1316 while(this->graph->valid(e.out) && !enabled(e)) {1317 this->graph->next(e.out); }1318 }1319 return e;1320 }1321 EdgeIt& next(EdgeIt& e) const {1322 if (!e.backward) {1323 this->graph->next(e.e);1324 while(this->graph->valid(e.e) && !enabled(e)) {1325 this->graph->next(e.e); }1326 if (!this->graph->valid(e.e)) {1327 e.backward=true;1328 this->graph->first(e.e);1329 while(this->graph->valid(e.e) && !enabled(e)) {1330 this->graph->next(e.e); }1331 }1332 } else {1333 this->graph->next(e.e);1334 while(this->graph->valid(e.e) && !enabled(e)) {1335 this->graph->next(e.e); }1336 }1337 return e;1338 }1339 1340 Node tail(Edge e) const {1341 return ((!e.backward) ? this->graph->tail(e) : this->graph->head(e)); }1342 Node head(Edge e) const {1343 return ((!e.backward) ? this->graph->head(e) : this->graph->tail(e)); }1344 1345 Node aNode(OutEdgeIt e) const {1346 return ((!e.backward) ? this->graph->aNode(e.out) :1347 this->graph->aNode(e.in)); }1348 Node bNode(OutEdgeIt e) const {1349 return ((!e.backward) ? this->graph->bNode(e.out) :1350 this->graph->bNode(e.in)); }1351 1352 Node aNode(InEdgeIt e) const {1353 return ((!e.backward) ? this->graph->aNode(e.in) :1354 this->graph->aNode(e.out)); }1355 Node bNode(InEdgeIt e) const {1356 return ((!e.backward) ? this->graph->bNode(e.in) :1357 this->graph->bNode(e.out)); }1358 1359 /// Gives back the opposite edge.1360 Edge opposite(const Edge& e) const {1361 Edge f=e;1362 f.backward=!f.backward;1363 return f;1364 }1365 1366 // int nodeNum() const { return graph->nodeNum(); }1367 //FIXME1368 void edgeNum() const { }1369 //int edgeNum() const { return graph->edgeNum(); }1370 1371 1372 // int id(Node v) const { return graph->id(v); }1373 1374 bool valid(Node n) const { return GraphWrapper<Graph>::valid(n); }1375 bool valid(Edge e) const {1376 return this->graph->valid(e);1377 //return e.forward ? graph->valid(e.out) : graph->valid(e.in);1378 }1379 1380 bool forward(const Edge& e) const { return !e.backward; }1381 bool backward(const Edge& e) const { return e.backward; }1382 1383 bool enabled(const Edge& e) const {1384 if (!e.backward)1385 // return (capacity->get(e.out)-flow->get(e.out));1386 //return ((*capacity)[e]-(*flow)[e]);1387 return true;1388 else1389 // return (flow->get(e.in));1390 //return ((*flow)[e]);1391 return true;1392 }1393 1394 // Number enabled(typename Graph::OutEdgeIt out) const {1395 // // return (capacity->get(out)-flow->get(out));1396 // return ((*capacity)[out]-(*flow)[out]);1397 // }1398 1399 // Number enabled(typename Graph::InEdgeIt in) const {1400 // // return (flow->get(in));1401 // return ((*flow)[in]);1402 // }1403 1404 template <typename T>1405 class EdgeMap {1406 typename Graph::template EdgeMap<T> forward_map, backward_map;1407 public:1408 typedef T ValueType;1409 typedef Edge KeyType;1410 EdgeMap(const OldBidirGraphWrapper<Graph>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }1411 EdgeMap(const OldBidirGraphWrapper<Graph>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }1412 void set(Edge e, T a) {1413 if (!e.backward)1414 forward_map.set(e/*.out*/, a);1415 else1416 backward_map.set(e/*.in*/, a);1417 }1418 T operator[](Edge e) const {1419 if (!e.backward)1420 return forward_map[e/*.out*/];1421 else1422 return backward_map[e/*.in*/];1423 }1424 void update() {1425 forward_map.update();1426 backward_map.update();1427 }1428 // T get(Edge e) const {1429 // if (e.out_or_in)1430 // return forward_map.get(e.out);1431 // else1432 // return backward_map.get(e.in);1433 // }1434 };1435 };1436 1437 1438 1439 1125 /// \brief A bidirected graph template. 1440 1126 /// … … 1597 1283 1598 1284 }; 1599 1600 1601 template<typename Graph, typename Number,1602 typename CapacityMap, typename FlowMap>1603 class OldResGraphWrapper : public GraphWrapper<Graph> {1604 public:1605 typedef GraphWrapper<Graph> Parent;1606 protected:1607 const CapacityMap* capacity;1608 FlowMap* flow;1609 1610 OldResGraphWrapper() : GraphWrapper<Graph>(0),1611 capacity(0), flow(0) { }1612 void setCapacityMap(const CapacityMap& _capacity) {1613 capacity=&_capacity;1614 }1615 void setFlowMap(FlowMap& _flow) {1616 flow=&_flow;1617 }1618 1619 public:1620 1621 OldResGraphWrapper(Graph& _graph, const CapacityMap& _capacity,1622 FlowMap& _flow) :1623 GraphWrapper<Graph>(_graph), capacity(&_capacity), flow(&_flow) { }1624 1625 class Edge;1626 class OutEdgeIt;1627 friend class Edge;1628 friend class OutEdgeIt;1629 1630 typedef typename GraphWrapper<Graph>::Node Node;1631 typedef typename GraphWrapper<Graph>::NodeIt NodeIt;1632 class Edge : public Graph::Edge {1633 friend class OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>;1634 protected:1635 bool backward; //true, iff backward1636 // typename Graph::Edge e;1637 public:1638 Edge() { }1639 Edge(const typename Graph::Edge& _e, bool _backward) :1640 Graph::Edge(_e), backward(_backward) { }1641 Edge(const Invalid& i) : Graph::Edge(i), backward(true) { }1642 //the unique invalid iterator1643 friend bool operator==(const Edge& u, const Edge& v) {1644 return (v.backward==u.backward &&1645 static_cast<typename Graph::Edge>(u)==1646 static_cast<typename Graph::Edge>(v));1647 }1648 friend bool operator!=(const Edge& u, const Edge& v) {1649 return (v.backward!=u.backward ||1650 static_cast<typename Graph::Edge>(u)!=1651 static_cast<typename Graph::Edge>(v));1652 }1653 };1654 1655 class OutEdgeIt {1656 friend class OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>;1657 protected:1658 typename Graph::OutEdgeIt out;1659 typename Graph::InEdgeIt in;1660 bool backward;1661 public:1662 OutEdgeIt() { }1663 //FIXME1664 // OutEdgeIt(const Edge& e) : Edge(e) { }1665 OutEdgeIt(const Invalid& i) : out(i), in(i), backward(true) { }1666 //the unique invalid iterator1667 OutEdgeIt(const OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G, Node v) {1668 backward=false;1669 _G.graph->first(out, v);1670 while( _G.graph->valid(out) && !(_G.resCap(*this)>0) ) { _G.graph->next(out); }1671 if (!_G.graph->valid(out)) {1672 backward=true;1673 _G.graph->first(in, v);1674 while( _G.graph->valid(in) && !(_G.resCap(*this)>0) ) { _G.graph->next(in); }1675 }1676 }1677 operator Edge() const {1678 // Edge e;1679 // e.forward=this->forward;1680 // if (this->forward) e=out; else e=in;1681 // return e;1682 if (this->backward)1683 return Edge(in, this->backward);1684 else1685 return Edge(out, this->backward);1686 }1687 };1688 1689 class InEdgeIt {1690 friend class OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>;1691 protected:1692 typename Graph::OutEdgeIt out;1693 typename Graph::InEdgeIt in;1694 bool backward;1695 public:1696 InEdgeIt() { }1697 //FIXME1698 // OutEdgeIt(const Edge& e) : Edge(e) { }1699 InEdgeIt(const Invalid& i) : out(i), in(i), backward(true) { }1700 //the unique invalid iterator1701 InEdgeIt(const OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G, Node v) {1702 backward=false;1703 _G.graph->first(in, v);1704 while( _G.graph->valid(in) && !(_G.resCap(*this)>0) ) { _G.graph->next(in); }1705 if (!_G.graph->valid(in)) {1706 backward=true;1707 _G.graph->first(out, v);1708 while( _G.graph->valid(out) && !(_G.resCap(*this)>0) ) { _G.graph->next(out); }1709 }1710 }1711 operator Edge() const {1712 // Edge e;1713 // e.forward=this->forward;1714 // if (this->forward) e=out; else e=in;1715 // return e;1716 if (this->backward)1717 return Edge(out, this->backward);1718 else1719 return Edge(in, this->backward);1720 }1721 };1722 1723 class EdgeIt {1724 friend class OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>;1725 protected:1726 typename Graph::EdgeIt e;1727 bool backward;1728 public:1729 EdgeIt() { }1730 EdgeIt(const Invalid& i) : e(i), backward(true) { }1731 EdgeIt(const OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G) {1732 backward=false;1733 _G.graph->first(e);1734 while (_G.graph->valid(e) && !(_G.resCap(*this)>0)) _G.graph->next(e);1735 if (!_G.graph->valid(e)) {1736 backward=true;1737 _G.graph->first(e);1738 while (_G.graph->valid(e) && !(_G.resCap(*this)>0)) _G.graph->next(e);1739 }1740 }1741 operator Edge() const {1742 return Edge(e, this->backward);1743 }1744 };1745 1746 using GraphWrapper<Graph>::first;1747 // NodeIt& first(NodeIt& i) const {1748 // i=NodeIt(*this); return i;1749 // }1750 OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {1751 i=OutEdgeIt(*this, p); return i;1752 }1753 // FIXME not tested1754 InEdgeIt& first(InEdgeIt& i, const Node& p) const {1755 i=InEdgeIt(*this, p); return i;1756 }1757 EdgeIt& first(EdgeIt& i) const {1758 i=EdgeIt(*this); return i;1759 }1760 1761 using GraphWrapper<Graph>::next;1762 // NodeIt& next(NodeIt& n) const { GraphWrapper<Graph>::next(n); return n; }1763 OutEdgeIt& next(OutEdgeIt& e) const {1764 if (!e.backward) {1765 Node v=this->graph->aNode(e.out);1766 this->graph->next(e.out);1767 while( this->graph->valid(e.out) && !(resCap(e)>0) ) {1768 this->graph->next(e.out); }1769 if (!this->graph->valid(e.out)) {1770 e.backward=true;1771 this->graph->first(e.in, v);1772 while( this->graph->valid(e.in) && !(resCap(e)>0) ) {1773 this->graph->next(e.in); }1774 }1775 } else {1776 this->graph->next(e.in);1777 while( this->graph->valid(e.in) && !(resCap(e)>0) ) {1778 this->graph->next(e.in); }1779 }1780 return e;1781 }1782 // FIXME Not tested1783 InEdgeIt& next(InEdgeIt& e) const {1784 if (!e.backward) {1785 Node v=this->graph->aNode(e.in);1786 this->graph->next(e.in);1787 while( this->graph->valid(e.in) && !(resCap(e)>0) ) {1788 this->graph->next(e.in); }1789 if (!this->graph->valid(e.in)) {1790 e.backward=true;1791 this->graph->first(e.out, v);1792 while( this->graph->valid(e.out) && !(resCap(e)>0) ) {1793 this->graph->next(e.out); }1794 }1795 } else {1796 this->graph->next(e.out);1797 while( this->graph->valid(e.out) && !(resCap(e)>0) ) {1798 this->graph->next(e.out); }1799 }1800 return e;1801 }1802 EdgeIt& next(EdgeIt& e) const {1803 if (!e.backward) {1804 this->graph->next(e.e);1805 while( this->graph->valid(e.e) && !(resCap(e)>0) ) {1806 this->graph->next(e.e); }1807 if (!this->graph->valid(e.e)) {1808 e.backward=true;1809 this->graph->first(e.e);1810 while( this->graph->valid(e.e) && !(resCap(e)>0) ) {1811 this->graph->next(e.e); }1812 }1813 } else {1814 this->graph->next(e.e);1815 while( this->graph->valid(e.e) && !(resCap(e)>0) ) {1816 this->graph->next(e.e); }1817 }1818 return e;1819 }1820 1821 Node tail(Edge e) const {1822 return ((!e.backward) ? this->graph->tail(e) : this->graph->head(e)); }1823 Node head(Edge e) const {1824 return ((!e.backward) ? this->graph->head(e) : this->graph->tail(e)); }1825 1826 Node aNode(OutEdgeIt e) const {1827 return ((!e.backward) ? this->graph->aNode(e.out) :1828 this->graph->aNode(e.in)); }1829 Node bNode(OutEdgeIt e) const {1830 return ((!e.backward) ? this->graph->bNode(e.out) :1831 this->graph->bNode(e.in)); }1832 1833 Node aNode(InEdgeIt e) const {1834 return ((!e.backward) ? this->graph->aNode(e.in) :1835 this->graph->aNode(e.out)); }1836 Node bNode(InEdgeIt e) const {1837 return ((!e.backward) ? this->graph->bNode(e.in) :1838 this->graph->bNode(e.out)); }1839 1840 // int nodeNum() const { return graph->nodeNum(); }1841 //FIXME1842 void edgeNum() const { }1843 //int edgeNum() const { return graph->edgeNum(); }1844 1845 1846 // int id(Node v) const { return graph->id(v); }1847 1848 bool valid(Node n) const { return GraphWrapper<Graph>::valid(n); }1849 bool valid(Edge e) const {1850 return this->graph->valid(e);1851 //return e.forward ? graph->valid(e.out) : graph->valid(e.in);1852 }1853 1854 bool forward(const Edge& e) const { return !e.backward; }1855 bool backward(const Edge& e) const { return e.backward; }1856 1857 void augment(const Edge& e, Number a) const {1858 if (!e.backward)1859 // flow->set(e.out, flow->get(e.out)+a);1860 flow->set(e, (*flow)[e]+a);1861 else1862 // flow->set(e.in, flow->get(e.in)-a);1863 flow->set(e, (*flow)[e]-a);1864 }1865 1866 Number resCap(const Edge& e) const {1867 if (!e.backward)1868 // return (capacity->get(e.out)-flow->get(e.out));1869 return ((*capacity)[e]-(*flow)[e]);1870 else1871 // return (flow->get(e.in));1872 return ((*flow)[e]);1873 }1874 1875 // Number resCap(typename Graph::OutEdgeIt out) const {1876 // // return (capacity->get(out)-flow->get(out));1877 // return ((*capacity)[out]-(*flow)[out]);1878 // }1879 1880 // Number resCap(typename Graph::InEdgeIt in) const {1881 // // return (flow->get(in));1882 // return ((*flow)[in]);1883 // }1884 1885 template <typename T>1886 class EdgeMap {1887 typename Graph::template EdgeMap<T> forward_map, backward_map;1888 public:1889 typedef T ValueType;1890 typedef Edge KeyType;1891 EdgeMap(const OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }1892 EdgeMap(const OldResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }1893 void set(Edge e, T a) {1894 if (!e.backward)1895 forward_map.set(e/*.out*/, a);1896 else1897 backward_map.set(e/*.in*/, a);1898 }1899 T operator[](Edge e) const {1900 if (!e.backward)1901 return forward_map[e/*.out*/];1902 else1903 return backward_map[e/*.in*/];1904 }1905 void update() {1906 forward_map.update();1907 backward_map.update();1908 }1909 // T get(Edge e) const {1910 // if (e.out_or_in)1911 // return forward_map.get(e.out);1912 // else1913 // return backward_map.get(e.in);1914 // }1915 };1916 };1917 1918 1285 1919 1286
Note: See TracChangeset
for help on using the changeset viewer.