marci@44
|
1 |
ETIK-OL-NOLIB-NEGRES full feature graph minimum concept.
|
marci@44
|
2 |
|
marci@44
|
3 |
Regota filozunk rajta hogy hogy is kene kinezni a fent emlitett concept-nek,
|
marci@44
|
4 |
most 1 egesz konkret javaslatot irnek. A fo cel, hogy lenyegeben
|
marci@44
|
5 |
minden operaciot a graf vegezzen, es az iteratorok csak vmi leiro szerepet
|
marci@44
|
6 |
toltsenek be. Azt is megfigyeltuk, hogy a fo technikai nehezseg, hogy a c++
|
marci@44
|
7 |
nem tud a visszateresi ertek alapjan megkulonboztetni fuggvenyeket. Ennek
|
marci@44
|
8 |
megfeleloen 2 javaslatot irok most. Az egyikben a fv altal kiszamolt erteket
|
marci@44
|
9 |
az egyik operandusban kapjuk vissza, a masikban egy tag-template specializacip
|
marci@44
|
10 |
eredmenyekent balra adja vissza a cuccot. Nehol referencia van irva ahol nem
|
marci@44
|
11 |
kell, ezen ne tessek fonnakadni.
|
marci@44
|
12 |
|
marci@44
|
13 |
class Graph;
|
marci@44
|
14 |
|
marci@44
|
15 |
class NodeIt;
|
marci@44
|
16 |
trivialis node iterator, csak cimezni lehet vele, pl property vectort
|
marci@44
|
17 |
class EachNodeIt;
|
marci@44
|
18 |
node iterator a graf pontjainak bejarasara, NodeIt-e konvertalhato
|
marci@44
|
19 |
|
marci@44
|
20 |
class EdgeIt;
|
marci@44
|
21 |
trivialis edge iterator, csak cimezni lehet vele, pl property vectort
|
marci@44
|
22 |
class EachEdgeIt;
|
marci@44
|
23 |
edge iterator a graf osszes elenek bejarasara
|
marci@44
|
24 |
class OutEdgeIt;
|
marci@44
|
25 |
edge iterator 1 pont ki eleinek bejarasara, EdgeIt-e konvertalhato
|
marci@44
|
26 |
class InEdgeIt;
|
marci@44
|
27 |
edge iterator 1 pont be eleinek bejarasara, EdgeIt-e konvertalhato
|
marci@44
|
28 |
class SymEdgeIt;
|
marci@44
|
29 |
edge iterator 1 pont be es ki eleinek bejarasara, EdgeIt-e konvertalhato
|
marci@44
|
30 |
|
marci@44
|
31 |
Az iteratorok ures konstruktorai invalid iteratort konstrualnak.
|
marci@44
|
32 |
|
marci@44
|
33 |
template<typename ValueType> class NodeMap;
|
marci@44
|
34 |
template<typename ValueType> class EdgeMap;
|
marci@44
|
35 |
|
marci@44
|
36 |
Graph();
|
marci@44
|
37 |
default constructor
|
marci@44
|
38 |
|
marci@44
|
39 |
A kovetkezo cuccokbol kell valasztani:
|
marci@44
|
40 |
|
marci@44
|
41 |
NodeIt tail(const EdgeIt) const;
|
marci@44
|
42 |
NodeIt head(const EdgeIt) const;
|
marci@44
|
43 |
|
marci@44
|
44 |
NodeIt aNode(const OutEdgeIt) const;
|
marci@44
|
45 |
NodeIt aNode(const InEdgeIt) const;
|
marci@44
|
46 |
NodeIt aNode(const SymEdgeIt) const;
|
marci@44
|
47 |
az out, in or sym edge iterator rogzitett pontjara ad 1 NodeIt-t
|
marci@44
|
48 |
|
marci@44
|
49 |
NodeIt bNode(const OutEdgeIt) const;
|
marci@44
|
50 |
NodeIt bNode(const InEdgeIt) const;
|
marci@44
|
51 |
NodeIt bNode(const SymEdgeIt) const;
|
marci@44
|
52 |
az out, in or sym edge iterator nem rogzitett pontjara ad 1 NodeIt-t
|
marci@44
|
53 |
|
marci@44
|
54 |
EachNodeIt first<EachNodeIt>() const;
|
marci@44
|
55 |
EachEdgeIt first<EachEdgeIt>() const;
|
marci@44
|
56 |
OutEdgeIt first<OutEdgeIt>(const NodeIt) const;
|
marci@44
|
57 |
InEdgeIt first<InEdgeIt>(const NodeIt) const;
|
marci@44
|
58 |
SymEdgeIt first<SymEdgeIt>(const NodeIt) const;
|
marci@44
|
59 |
EachNodeIt get<EachNodeIt>(const NodeIt) const; ??? konverzio miatt
|
marci@44
|
60 |
EachEdgeIt get<EachEdgeIt>(const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
61 |
OutEdgeIt get<OutEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
62 |
InEdgeIt get<InEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
63 |
SymEdgeIt get<SymEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
64 |
|
marci@44
|
65 |
A masik lehetoseg pedig:
|
marci@44
|
66 |
|
marci@44
|
67 |
void getTail(NodeIt&, const EdgeIt) const;
|
marci@44
|
68 |
void getHead(NodeIt&, const EdgeIt) const;
|
marci@44
|
69 |
|
marci@44
|
70 |
void getANode(NodeIt&, const OutEdgeIt) const;
|
marci@44
|
71 |
void getANode(NodeIt&, const InEdgeIt) const;
|
marci@44
|
72 |
void getANode(NodeIt&, const SymEdgeIt) const;
|
marci@44
|
73 |
|
marci@44
|
74 |
void getBNode(NodeIt&, const OutEdgeIt) const;
|
marci@44
|
75 |
void getBNode(NodeIt&, const InEdgeIt) const;
|
marci@44
|
76 |
void getBNode(NodeIt&, const SymEdgeIt) const;
|
marci@44
|
77 |
|
marci@44
|
78 |
void getFirst(EachNodeIt&) const;
|
marci@44
|
79 |
void getFirst(EachEdgeIt&) const;
|
marci@44
|
80 |
void getFirst(OutEdgeIt&, const NodeIt) const;
|
marci@44
|
81 |
void getFirst(InEdgeIt&, const NodeIt) const;
|
marci@44
|
82 |
void getFirst(SymEdgeIt&, const NodeIt) const;
|
marci@44
|
83 |
void get(EachNodeIt&, const NodeIt) const; ??? konverzio miatt
|
marci@44
|
84 |
void get(EachEdgeIt&, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
85 |
void get(OutEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
86 |
void get(InEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
87 |
void get(SymEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
|
marci@44
|
88 |
|
marci@44
|
89 |
Itt er veget az alternativ ize.
|
marci@44
|
90 |
|
marci@44
|
91 |
Pontok azonositasara de meginkabb property vectorokhoz:
|
marci@44
|
92 |
|
marci@44
|
93 |
int id(const NodeIt&) const;
|
marci@44
|
94 |
int id(const EdgeIt&) const;
|
marci@44
|
95 |
|
marci@44
|
96 |
int nodeNum() const;
|
marci@44
|
97 |
int edgeNum() const;
|
marci@44
|
98 |
|
marci@44
|
99 |
Pontok es elek hozzaadasanak metodusai:
|
marci@44
|
100 |
|
marci@44
|
101 |
NodeIt addNode();
|
marci@44
|
102 |
EdgeIt addEdge(const NodeIt, const NodeIt);
|
marci@44
|
103 |
|
marci@44
|
104 |
void deleteNode(const NodeIt);
|
marci@44
|
105 |
void deleteEdge(const EdgeIt);
|
marci@44
|
106 |
|
marci@44
|
107 |
void setTail(const NodeIt); vagy void setTail(NodeIt); nem tom
|
marci@44
|
108 |
void setHead(const NodeIt); vagy void setHead(NodeIt); nem tom
|
marci@44
|
109 |
|
marci@44
|
110 |
Hogy konnyebb legyen a progikat tesztelni, nehany stream utasitas:
|
marci@44
|
111 |
ezek nem a ListGraph metodusai
|
marci@44
|
112 |
|
marci@44
|
113 |
friend std::ostream& operator<<(std::ostream&, const NodeIt&);
|
marci@44
|
114 |
friend std::ostream& operator<<(std::ostream&, const EdgeIt&);
|
marci@44
|
115 |
|
marci@44
|
116 |
AZ iteratorok leptetesere ket lehetoseg van, az iterator ++ operatora, a
|
marci@44
|
117 |
masik pedig
|
marci@44
|
118 |
It G.next(It) const;
|
marci@44
|
119 |
const G.next(const It) const;
|
marci@44
|
120 |
It& G.setNext(It&) const; G.goNext(It&) const; G.moveNext(It&) const; mi a jobb szo?
|
marci@44
|
121 |
|
marci@44
|
122 |
Kerdes: A bool valid()-nak ki kell-e jelenteni magarol, hogy const??
|
marci@44
|
123 |
NodeIt metodusai:
|
marci@44
|
124 |
NodeIt();
|
marci@44
|
125 |
bool valid() const;
|
marci@44
|
126 |
ezek nem tagfuggvenyek:
|
marci@44
|
127 |
friend bool operator==(const NodeIt&, const NodeIt&);
|
marci@44
|
128 |
friend bool operator!=(const NodeIt&, const NodeIt&);
|
marci@44
|
129 |
|
marci@44
|
130 |
EachNodeIt metodusai:
|
marci@44
|
131 |
ez publikusan szarmazik a NodeIt-bol, tehat a fentiek is.
|
marci@44
|
132 |
EachNodeIt();
|
marci@44
|
133 |
EachNodeIt& operator++();
|
marci@44
|
134 |
|
marci@44
|
135 |
EdgeIt metodusai:
|
marci@44
|
136 |
EdgeIt();
|
marci@44
|
137 |
bool valid() const;
|
marci@44
|
138 |
ezek nem tagfvek:
|
marci@44
|
139 |
friend bool operator==(const EdgeIt&, const EdgeIt&);
|
marci@44
|
140 |
friend bool operator!=(const EdgeIt&, const EdgeIt&);
|
marci@44
|
141 |
ujra tagfv-ek.
|
marci@44
|
142 |
|
marci@44
|
143 |
EachEdgeIt metodusai:
|
marci@44
|
144 |
EdgeIt-bol szarmazik
|
marci@44
|
145 |
EachEdgeIt();
|
marci@44
|
146 |
EachEdgeIt& operator++();
|
marci@44
|
147 |
|
marci@44
|
148 |
OutEdgeIt metodusai:
|
marci@44
|
149 |
EdgeIt-bol szarmazik
|
marci@44
|
150 |
OutEdgeIt();
|
marci@44
|
151 |
OutEdgeIt& operator++();
|
marci@44
|
152 |
|
marci@44
|
153 |
InEdgeIt metodusai:
|
marci@44
|
154 |
EdgeIt-bol szarmazik
|
marci@44
|
155 |
InEdgeIt();
|
marci@44
|
156 |
InEdgeIt& operator++();
|
marci@44
|
157 |
|
marci@44
|
158 |
SymEdgeIt metodusai:
|
marci@44
|
159 |
EdgeIt-bol szarmazik
|
marci@44
|
160 |
SymEdgeIt();
|
marci@44
|
161 |
SymEdgeIt& operator++();
|
marci@44
|
162 |
|
marci@44
|
163 |
Ami itt kovetkezik az mar nem lenyeg, sot valtozni fog.
|
marci@44
|
164 |
|
marci@44
|
165 |
Node propery array-okrol:
|
marci@44
|
166 |
|
marci@44
|
167 |
template <typename ValueType>
|
marci@44
|
168 |
class NodeMap;
|
marci@44
|
169 |
|
marci@44
|
170 |
metodusok:
|
marci@44
|
171 |
|
marci@44
|
172 |
NodeMap(const Graph&);
|
marci@44
|
173 |
NodeMap(const Graph&, const ValueType);
|
marci@44
|
174 |
void set(Graph::NodeIt, const ValueType);
|
marci@44
|
175 |
//void put(Graph::NodeIt, const ValueType);
|
marci@44
|
176 |
ValueType get(Graph::NodeIt) const;
|
marci@44
|
177 |
|
marci@44
|
178 |
Ugyanez edge_property_array-okkal
|
marci@44
|
179 |
|
marci@44
|
180 |
template <typename ValueType>
|
marci@44
|
181 |
class EdgeMap;
|
marci@44
|
182 |
|
marci@44
|
183 |
EdgeMap(const Graph&);
|
marci@44
|
184 |
EdgeMap(const Graph&, const ValueType);
|
marci@44
|
185 |
void set(Graph::EdgeIt, const ValueType);
|
marci@44
|
186 |
//void put(Graph::EdgeIt, const ValueType);
|
marci@44
|
187 |
ValueType get(Graph::EdgeIt) const;
|
marci@44
|
188 |
|
marci@44
|
189 |
marci@cs.elte.hu |