alpar@65
|
1 |
// -*-mode: c++; -*-
|
alpar@65
|
2 |
|
alpar@65
|
3 |
template<typename G>
|
alpar@65
|
4 |
class TrivGraphWrapper
|
alpar@65
|
5 |
{
|
alpar@65
|
6 |
G *graph;
|
alpar@65
|
7 |
|
alpar@65
|
8 |
public:
|
alpar@65
|
9 |
typedef G BaseGraph;
|
alpar@65
|
10 |
|
alpar@65
|
11 |
typedef typename G::EdgeIt EdgeIt;
|
alpar@65
|
12 |
|
alpar@65
|
13 |
typedef typename G::InEdgeIt InEdgeIt;
|
alpar@65
|
14 |
typedef typename G::OutEdgeIt OutEdgeIt;
|
alpar@65
|
15 |
typedef typename G::SymEdgeIt SymEdgeIt;
|
alpar@65
|
16 |
typedef typename G::EachEdgeIt EachEdgeIt;
|
alpar@65
|
17 |
|
alpar@65
|
18 |
typedef typename G::NodeIt NodeIt;
|
alpar@65
|
19 |
|
alpar@65
|
20 |
template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
|
alpar@65
|
21 |
template<typename I,typename P> I &getFirst(I &i,const P &p);
|
alpar@65
|
22 |
{ return graph->getFirst(i,p); }
|
alpar@65
|
23 |
template<typename I> I next(const I i); { return graph->goNext(i); }
|
alpar@65
|
24 |
template<typename I> I &goNext(I &i); { return graph->goNext(i); }
|
alpar@65
|
25 |
|
alpar@65
|
26 |
NodeIt head(const EdgeIt &e);
|
alpar@65
|
27 |
{ return graph->head(e); }
|
alpar@65
|
28 |
NodeIt tail(const EdgeIt &e);
|
alpar@65
|
29 |
{ return graph->tail(e); }
|
alpar@65
|
30 |
|
alpar@65
|
31 |
template<typename I> NodeIt aNode(const I e);
|
alpar@65
|
32 |
{ return graph->aNode(e); }
|
alpar@65
|
33 |
template<typename I> NodeIt bNode(const I e);
|
alpar@65
|
34 |
{ return graph->bNode(e); }
|
alpar@65
|
35 |
|
alpar@65
|
36 |
template<typename I> bool valid(const I i);
|
alpar@65
|
37 |
{ return graph->valid(i); }
|
alpar@65
|
38 |
|
alpar@65
|
39 |
template<typename I> void setInvalid(const I &i);
|
alpar@65
|
40 |
{ return graph->setInvalid(i); }
|
alpar@65
|
41 |
|
alpar@65
|
42 |
NodeIt addNode(); { return graph->addNode(); }
|
alpar@65
|
43 |
EdgeIt addEdge(const NodeIt from,const NodeIt to);
|
alpar@65
|
44 |
{ return graph->addEdge(ftom,to); }
|
alpar@65
|
45 |
|
alpar@65
|
46 |
template<I> void delete(I i); { graph->delete(i); }
|
alpar@65
|
47 |
|
alpar@65
|
48 |
void clean(); { graph->clean(); }
|
alpar@65
|
49 |
|
alpar@65
|
50 |
template<class T> class NodeMap : public typename G::NodeMap<T>;
|
alpar@65
|
51 |
template<class T> class EdgeMap : public typename G::EdgeMap<T>;
|
alpar@65
|
52 |
|
alpar@65
|
53 |
void SetG(G &g) {graph = &g;}
|
alpar@65
|
54 |
|
alpar@65
|
55 |
TrivGraphWrapper() {graph = NULL;}
|
alpar@65
|
56 |
TrivGraphWrapper(G &g) {graph = &g;}
|
alpar@65
|
57 |
};
|
alpar@65
|
58 |
|
alpar@65
|
59 |
template<typename G>
|
alpar@65
|
60 |
class RevGraphWrapper
|
alpar@65
|
61 |
{
|
alpar@65
|
62 |
G *graph;
|
alpar@65
|
63 |
|
alpar@65
|
64 |
public:
|
alpar@65
|
65 |
typedef G BaseGraph;
|
alpar@65
|
66 |
|
alpar@65
|
67 |
typedef typename G::EdgeIt EdgeIt;
|
alpar@65
|
68 |
|
alpar@65
|
69 |
typedef typename G::InEdgeIt OutEdgeIt;
|
alpar@65
|
70 |
typedef typename G::OutEdgeIt InEdgeIt;
|
alpar@65
|
71 |
typedef typename G::SymEdgeIt SymEdgeIt;
|
alpar@65
|
72 |
typedef typename G::EachEdgeIt EachEdgeIt;
|
alpar@65
|
73 |
|
alpar@65
|
74 |
typedef typename G::NodeIt NodeIt;
|
alpar@65
|
75 |
|
alpar@65
|
76 |
template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
|
alpar@65
|
77 |
template<typename I,typename P> I &getFirst(I &i,const P &p);
|
alpar@65
|
78 |
{ return graph->getFirst(i,p); }
|
alpar@65
|
79 |
template<typename I> I next(const I i); { return graph->goNext(i); }
|
alpar@65
|
80 |
template<typename I> I &goNext(I &i); { return graph->goNext(i); }
|
alpar@65
|
81 |
|
alpar@65
|
82 |
NodeIt head(const EdgeIt &e);
|
alpar@65
|
83 |
{ return graph->tail(e); }
|
alpar@65
|
84 |
NodeIt tail(const EdgeIt &e);
|
alpar@65
|
85 |
{ return graph->head(e); }
|
alpar@65
|
86 |
|
alpar@65
|
87 |
template<typename I> NodeIt aNode(const I e);
|
alpar@65
|
88 |
{ return graph->aNode(e); }
|
alpar@65
|
89 |
template<typename I> NodeIt bNode(const I e);
|
alpar@65
|
90 |
{ return graph->bNode(e); }
|
alpar@65
|
91 |
|
alpar@65
|
92 |
template<typename I> bool valid(const I i);
|
alpar@65
|
93 |
{ return graph->valid(i); }
|
alpar@65
|
94 |
|
alpar@65
|
95 |
template<typename I> void setInvalid(const I &i);
|
alpar@65
|
96 |
{ return graph->setInvalid(i); }
|
alpar@65
|
97 |
|
alpar@65
|
98 |
NodeIt addNode(); { return graph->addNode(); }
|
alpar@65
|
99 |
EdgeIt addEdge(const NodeIt from,const NodeIt to);
|
alpar@65
|
100 |
{ return graph->addEdge(to,from); }
|
alpar@65
|
101 |
|
alpar@65
|
102 |
template<I> void delete(I i); { graph->delete(i); }
|
alpar@65
|
103 |
|
alpar@65
|
104 |
void clean(); { graph->clean(); }
|
alpar@65
|
105 |
|
alpar@65
|
106 |
template<class T> class NodeMap : public typename G::NodeMap<T>;
|
alpar@65
|
107 |
template<class T> class EdgeMap : public typename G::EdgeMap<T>;
|
alpar@65
|
108 |
|
alpar@65
|
109 |
void SetG(G &g) {graph = &g;}
|
alpar@65
|
110 |
|
alpar@65
|
111 |
RevGraphWrapper() {graph = NULL;}
|
alpar@65
|
112 |
RevGraphWrapper(G &g) {graph = &g;}
|
alpar@65
|
113 |
};
|
alpar@65
|
114 |
|
alpar@65
|
115 |
|
alpar@65
|
116 |
|
alpar@65
|
117 |
// NodeIt &getFirst(NodeIt &n) { return graph->getFirst(n); }
|
alpar@65
|
118 |
// InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n);
|
alpar@65
|
119 |
// { return graph->getFirst(e,n); }
|
alpar@65
|
120 |
// OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n);
|
alpar@65
|
121 |
// { return graph->getFirst(e,n); }
|
alpar@65
|
122 |
// SymEdgeIt &getFirst(SymEdgeIt &e,const NodeIt &n);
|
alpar@65
|
123 |
// { return graph->getFirst(e,n); }
|
alpar@65
|
124 |
// EachEdgeIt &getFirst(EachEdgeIt &e);
|
alpar@65
|
125 |
// { return graph->getFirst(e); }
|
alpar@65
|
126 |
|
alpar@65
|
127 |
// NodeIt next(const NodeIt &n);
|
alpar@65
|
128 |
// { return graph->next(n); }
|
alpar@65
|
129 |
// InEdgeIt next(const InEdgeIt &e);
|
alpar@65
|
130 |
// { return graph->next(e); }
|
alpar@65
|
131 |
// OutEdgeIt next(const OutEdgeIt &e);
|
alpar@65
|
132 |
// { return graph->next(e); }
|
alpar@65
|
133 |
// SymEdgeIt next(const SymEdgeIt &e);
|
alpar@65
|
134 |
// { return graph->next(e); }
|
alpar@65
|
135 |
// EachEdgeIt next(const EachEdgeIt &e);
|
alpar@65
|
136 |
// { return graph->next(e); }
|
alpar@65
|
137 |
|
alpar@65
|
138 |
// NodeIt &goNext(NodeIt &n);
|
alpar@65
|
139 |
// { return graph->goNext(n); }
|
alpar@65
|
140 |
// InEdgeIt &goNext(InEdgeIt &e);
|
alpar@65
|
141 |
// { return graph->goNext(e); }
|
alpar@65
|
142 |
// OutEdgeIt &goNext(OutEdgeIt &e);
|
alpar@65
|
143 |
// { return graph->goNext(e); }
|
alpar@65
|
144 |
// SymEdgeIt &goNext(SymEdgeIt &e);
|
alpar@65
|
145 |
// { return graph->goNext(e); }
|
alpar@65
|
146 |
// EachEdgeIt &goNext(EachEdgeIt &e);
|
alpar@65
|
147 |
// { return graph->goNext(e); }
|
alpar@65
|
148 |
|