Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/ugraph_adaptor.h
- Timestamp:
- 03/02/07 19:04:28 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/ugraph_adaptor.h
r2381 r2386 100 100 101 101 typedef FindEdgeTagIndicator<Graph> FindEdgeTag; 102 Edge findEdge(const Node& source, const Node& target,102 Edge findEdge(const Node& u, const Node& v, 103 103 const Edge& prev = INVALID) { 104 return graph->findEdge( source, target, prev);105 } 106 UEdge findUEdge(const Node& source, const Node& target,104 return graph->findEdge(u, v, prev); 105 } 106 UEdge findUEdge(const Node& u, const Node& v, 107 107 const UEdge& prev = INVALID) { 108 return graph->findUEdge( source, target, prev);108 return graph->findUEdge(u, v, prev); 109 109 } 110 110 111 111 Node addNode() const { return graph->addNode(); } 112 UEdge addEdge(const Node& source, const Node& target) const {113 return graph->addEdge( source, target);112 UEdge addEdge(const Node& u, const Node& v) const { 113 return graph->addEdge(u, v); 114 114 } 115 115 … … 126 126 int id(const UEdge& e) const { return graph->id(e); } 127 127 128 Node fromNodeId(int i d) const {129 return graph->fromNodeId(i d);130 } 131 132 Edge fromEdgeId(int i d) const {133 return graph->fromEdgeId(i d);134 } 135 136 UEdge fromUEdgeId(int i d) const {137 return graph->fromUEdgeId(i d);128 Node fromNodeId(int ix) const { 129 return graph->fromNodeId(ix); 130 } 131 132 Edge fromEdgeId(int ix) const { 133 return graph->fromEdgeId(ix); 134 } 135 136 UEdge fromUEdgeId(int ix) const { 137 return graph->fromUEdgeId(ix); 138 138 } 139 139 … … 396 396 397 397 typedef FindEdgeTagIndicator<Graph> FindEdgeTag; 398 Edge findEdge(const Node& source, const Node& target,398 Edge findEdge(const Node& u, const Node& v, 399 399 const Edge& prev = INVALID) { 400 if (!(*node_filter_map)[ source] || !(*node_filter_map)[target]) {400 if (!(*node_filter_map)[u] || !(*node_filter_map)[v]) { 401 401 return INVALID; 402 402 } 403 Edge edge = Parent::findEdge( source, target, prev);403 Edge edge = Parent::findEdge(u, v, prev); 404 404 while (edge != INVALID && !(*uedge_filter_map)[edge]) { 405 edge = Parent::findEdge( source, target, edge);405 edge = Parent::findEdge(u, v, edge); 406 406 } 407 407 return edge; 408 408 } 409 UEdge findUEdge(const Node& source, const Node& target,409 UEdge findUEdge(const Node& u, const Node& v, 410 410 const UEdge& prev = INVALID) { 411 if (!(*node_filter_map)[ source] || !(*node_filter_map)[target]) {411 if (!(*node_filter_map)[u] || !(*node_filter_map)[v]) { 412 412 return INVALID; 413 413 } 414 UEdge uedge = Parent::findUEdge( source, target, prev);414 UEdge uedge = Parent::findUEdge(u, v, prev); 415 415 while (uedge != INVALID && !(*uedge_filter_map)[uedge]) { 416 uedge = Parent::findUEdge( source, target, uedge);416 uedge = Parent::findUEdge(u, v, uedge); 417 417 } 418 418 return uedge; … … 429 429 template NodeMap<_Value> > Parent; 430 430 431 NodeMap(const Graph& g raph)432 : Parent(g raph) {}433 NodeMap(const Graph& g raph, const _Value& value)434 : Parent(g raph, value) {}431 NodeMap(const Graph& g) 432 : Parent(g) {} 433 NodeMap(const Graph& g, const _Value& v) 434 : Parent(g, v) {} 435 435 436 436 NodeMap& operator=(const NodeMap& cmap) { … … 455 455 template EdgeMap<_Value> > Parent; 456 456 457 EdgeMap(const Graph& g raph)458 : Parent(g raph) {}459 EdgeMap(const Graph& g raph, const _Value& value)460 : Parent(g raph, value) {}457 EdgeMap(const Graph& g) 458 : Parent(g) {} 459 EdgeMap(const Graph& g, const _Value& v) 460 : Parent(g, v) {} 461 461 462 462 EdgeMap& operator=(const EdgeMap& cmap) { … … 481 481 template UEdgeMap<_Value> > Parent; 482 482 483 UEdgeMap(const Graph& g raph)484 : Parent(g raph) {}485 UEdgeMap(const Graph& g raph, const _Value& value)486 : Parent(g raph, value) {}483 UEdgeMap(const Graph& g) 484 : Parent(g) {} 485 UEdgeMap(const Graph& g, const _Value& v) 486 : Parent(g, v) {} 487 487 488 488 UEdgeMap& operator=(const UEdgeMap& cmap) { … … 623 623 624 624 typedef FindEdgeTagIndicator<Graph> FindEdgeTag; 625 Edge findEdge(const Node& source, const Node& target,625 Edge findEdge(const Node& u, const Node& v, 626 626 const Edge& prev = INVALID) { 627 Edge edge = Parent::findEdge( source, target, prev);627 Edge edge = Parent::findEdge(u, v, prev); 628 628 while (edge != INVALID && !(*uedge_filter_map)[edge]) { 629 edge = Parent::findEdge( source, target, edge);629 edge = Parent::findEdge(u, v, edge); 630 630 } 631 631 return edge; 632 632 } 633 UEdge findUEdge(const Node& source, const Node& target,633 UEdge findUEdge(const Node& u, const Node& v, 634 634 const UEdge& prev = INVALID) { 635 UEdge uedge = Parent::findUEdge( source, target, prev);635 UEdge uedge = Parent::findUEdge(u, v, prev); 636 636 while (uedge != INVALID && !(*uedge_filter_map)[uedge]) { 637 uedge = Parent::findUEdge( source, target, uedge);637 uedge = Parent::findUEdge(u, v, uedge); 638 638 } 639 639 return uedge; … … 650 650 template NodeMap<_Value> > Parent; 651 651 652 NodeMap(const Graph& g raph)653 : Parent(g raph) {}654 NodeMap(const Graph& g raph, const _Value& value)655 : Parent(g raph, value) {}652 NodeMap(const Graph& g) 653 : Parent(g) {} 654 NodeMap(const Graph& g, const _Value& v) 655 : Parent(g, v) {} 656 656 657 657 NodeMap& operator=(const NodeMap& cmap) { … … 676 676 template EdgeMap<_Value> > Parent; 677 677 678 EdgeMap(const Graph& g raph)679 : Parent(g raph) {}680 EdgeMap(const Graph& g raph, const _Value& value)681 : Parent(g raph, value) {}678 EdgeMap(const Graph& g) 679 : Parent(g) {} 680 EdgeMap(const Graph& g, const _Value& v) 681 : Parent(g, v) {} 682 682 683 683 EdgeMap& operator=(const EdgeMap& cmap) { … … 702 702 template UEdgeMap<_Value> > Parent; 703 703 704 UEdgeMap(const Graph& g raph)705 : Parent(g raph) {}706 UEdgeMap(const Graph& g raph, const _Value& value)707 : Parent(g raph, value) {}704 UEdgeMap(const Graph& g) 705 : Parent(g) {} 706 UEdgeMap(const Graph& g, const _Value& v) 707 : Parent(g, v) {} 708 708 709 709 UEdgeMap& operator=(const UEdgeMap& cmap) { … … 944 944 945 945 typedef FindEdgeTagIndicator<Graph> FindEdgeTag; 946 Edge findEdge(const Node& source, const Node& target,946 Edge findEdge(const Node& u, const Node& v, 947 947 const Edge& prev = INVALID) { 948 948 Edge edge = prev; 949 949 bool d = edge == INVALID ? true : (*direction)[edge]; 950 950 if (d) { 951 edge = graph->findUEdge( source, target, edge);951 edge = graph->findUEdge(u, v, edge); 952 952 while (edge != INVALID && !(*direction)[edge]) { 953 graph->findUEdge( source, target, edge);953 graph->findUEdge(u, v, edge); 954 954 } 955 955 if (edge != INVALID) return edge; 956 956 } 957 graph->findUEdge( target, source, edge);957 graph->findUEdge(v, u, edge); 958 958 while (edge != INVALID && (*direction)[edge]) { 959 graph->findUEdge( source, target, edge);959 graph->findUEdge(u, v, edge); 960 960 } 961 961 return edge; … … 966 966 } 967 967 968 Edge addEdge(const Node& source, const Node& target) const {969 Edge edge = graph->addEdge( source, target);970 direction->set(edge, graph->source(edge) == source);968 Edge addEdge(const Node& u, const Node& v) const { 969 Edge edge = graph->addEdge(u, v); 970 direction->set(edge, graph->source(edge) == u); 971 971 return edge; 972 972 }
Note: See TracChangeset
for help on using the changeset viewer.