Changeset 1538:777834118f73 in lemon0.x for lemon/graph_adaptor.h
 Timestamp:
 07/04/05 19:22:03 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2030
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/graph_adaptor.h
r1536 r1538 1216 1216 }; 1217 1217 1218 /// \e1219 1218 template <typename _Graph> 1220 1219 class NewEdgeSetAdaptorBase { … … 1414 1413 }; 1415 1414 1415 1416 /// \brief Graph adaptor using a node set of another graph and an 1417 /// own edge set. 1418 /// 1419 /// This structure can be used to establish another graph over a node set 1420 /// of an existing one. The node iterator will go through the nodes of the 1421 /// original graph. 1422 /// 1423 /// \param _Graph The type of the graph which shares its node set with 1424 /// this class. Its interface must conform to the \ref skeleton::StaticGraph 1425 /// "StaticGraph" concept. 1426 /// 1427 /// In the edge extension and removing it conforms to the 1428 /// \ref skeleton::ExtendableGraph "ExtendableGraph" concept. 1416 1429 template <typename _Graph> 1417 1430 class NewEdgeSetAdaptor : … … 1476 1489 public: 1477 1490 1491 /// \brief Constructor of the adaptor. 1492 /// 1493 /// Constructor of the adaptor. 1478 1494 NewEdgeSetAdaptor(const _Graph& _graph) : nodes(*this, _graph) { 1479 1495 Parent::initalize(_graph, nodes); … … 1481 1497 1482 1498 void clear() { 1499 Parent::getNotifier(Edge()).clear(); 1500 1483 1501 Parent::edges.clear(); 1484 1502 Parent::first_edge = 1; 1485 1503 Parent::first_free_edge = 1; 1486 1504 } 1505 1506 }; 1507 1508 /// \brief Graph adaptor using a node set of another graph and an 1509 /// own undir edge set. 1510 /// 1511 /// This structure can be used to establish another undirected graph over 1512 /// a node set of an existing one. The node iterator will go through the 1513 /// nodes of the original graph. 1514 /// 1515 /// \param _Graph The type of the graph which shares its node set with 1516 /// this class. Its interface must conform to the \ref skeleton::StaticGraph 1517 /// "StaticGraph" concept. 1518 /// 1519 /// In the edge extension and removing it conforms to the 1520 /// \ref skeleton::ExtendableGraph "ExtendableGraph" concept. 1521 template <typename _Graph> 1522 class NewUndirEdgeSetAdaptor : 1523 public ErasableUndirGraphExtender< 1524 ClearableUndirGraphExtender< 1525 ExtendableUndirGraphExtender< 1526 MappableUndirGraphExtender< 1527 IterableUndirGraphExtender< 1528 AlterableUndirGraphExtender< 1529 UndirGraphExtender< 1530 NewEdgeSetAdaptorBase<_Graph> > > > > > > > { 1531 1532 public: 1533 1534 typedef ErasableUndirGraphExtender< 1535 ClearableUndirGraphExtender< 1536 ExtendableUndirGraphExtender< 1537 MappableUndirGraphExtender< 1538 IterableUndirGraphExtender< 1539 AlterableUndirGraphExtender< 1540 UndirGraphExtender< 1541 NewEdgeSetAdaptorBase<_Graph> > > > > > > > Parent; 1542 1543 1544 typedef typename Parent::Node Node; 1545 typedef typename Parent::Edge Edge; 1546 typedef typename Parent::UndirEdge UndirEdge; 1547 1548 private: 1549 1550 virtual void _clear() { 1551 Parent::edges.clear(); 1552 Parent::first_edge = 1; 1553 Parent::first_free_edge = 1; 1554 Parent::getNotifier(Edge()).clear(); 1555 Parent::getNotifier(Node()).clear(); 1556 } 1557 1558 virtual void _add(const Node& node) { 1559 Parent::getNotifier(Node()).add(node); 1560 } 1561 1562 virtual void _erase(const Node& node) { 1563 Edge edge; 1564 Parent::firstOut(edge, node); 1565 while (edge != INVALID) { 1566 Parent::erase(edge); 1567 Parent::firstOut(edge, node); 1568 } 1569 1570 Parent::firstIn(edge, node); 1571 while (edge != INVALID) { 1572 Parent::erase(edge); 1573 Parent::firstIn(edge, node); 1574 } 1575 1576 Parent::getNotifier(Node()).erase(node); 1577 } 1578 1579 typedef typename Parent::NodesImpl NodesImpl; 1580 1581 NodesImpl nodes; 1582 1583 public: 1584 1585 1586 /// \brief Constructor of the adaptor. 1587 /// 1588 /// Constructor of the adaptor. 1589 NewUndirEdgeSetAdaptor(const _Graph& _graph) : nodes(*this, _graph) { 1590 Parent::initalize(_graph, nodes); 1591 } 1592 1593 void clear() { 1487 1594 Parent::getNotifier(Edge()).clear(); 1595 Parent::getNotifier(UndirEdge()).clear(); 1596 1597 Parent::edges.clear(); 1598 Parent::first_edge = 1; 1599 Parent::first_free_edge = 1; 1488 1600 } 1489 1601
Note: See TracChangeset
for help on using the changeset viewer.