1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/graph_concept.txt Fri Jan 30 14:50:10 2004 +0000
1.3 @@ -0,0 +1,189 @@
1.4 +ETIK-OL-NOLIB-NEGRES full feature graph minimum concept.
1.5 +
1.6 + Regota filozunk rajta hogy hogy is kene kinezni a fent emlitett concept-nek,
1.7 +most 1 egesz konkret javaslatot irnek. A fo cel, hogy lenyegeben
1.8 +minden operaciot a graf vegezzen, es az iteratorok csak vmi leiro szerepet
1.9 +toltsenek be. Azt is megfigyeltuk, hogy a fo technikai nehezseg, hogy a c++
1.10 +nem tud a visszateresi ertek alapjan megkulonboztetni fuggvenyeket. Ennek
1.11 +megfeleloen 2 javaslatot irok most. Az egyikben a fv altal kiszamolt erteket
1.12 +az egyik operandusban kapjuk vissza, a masikban egy tag-template specializacip
1.13 +eredmenyekent balra adja vissza a cuccot. Nehol referencia van irva ahol nem
1.14 +kell, ezen ne tessek fonnakadni.
1.15 +
1.16 +class Graph;
1.17 +
1.18 +class NodeIt;
1.19 +trivialis node iterator, csak cimezni lehet vele, pl property vectort
1.20 +class EachNodeIt;
1.21 +node iterator a graf pontjainak bejarasara, NodeIt-e konvertalhato
1.22 +
1.23 +class EdgeIt;
1.24 +trivialis edge iterator, csak cimezni lehet vele, pl property vectort
1.25 +class EachEdgeIt;
1.26 +edge iterator a graf osszes elenek bejarasara
1.27 +class OutEdgeIt;
1.28 +edge iterator 1 pont ki eleinek bejarasara, EdgeIt-e konvertalhato
1.29 +class InEdgeIt;
1.30 +edge iterator 1 pont be eleinek bejarasara, EdgeIt-e konvertalhato
1.31 +class SymEdgeIt;
1.32 +edge iterator 1 pont be es ki eleinek bejarasara, EdgeIt-e konvertalhato
1.33 +
1.34 +Az iteratorok ures konstruktorai invalid iteratort konstrualnak.
1.35 +
1.36 +template<typename ValueType> class NodeMap;
1.37 +template<typename ValueType> class EdgeMap;
1.38 +
1.39 +Graph();
1.40 +default constructor
1.41 +
1.42 +A kovetkezo cuccokbol kell valasztani:
1.43 +
1.44 +NodeIt tail(const EdgeIt) const;
1.45 +NodeIt head(const EdgeIt) const;
1.46 +
1.47 +NodeIt aNode(const OutEdgeIt) const;
1.48 +NodeIt aNode(const InEdgeIt) const;
1.49 +NodeIt aNode(const SymEdgeIt) const;
1.50 +az out, in or sym edge iterator rogzitett pontjara ad 1 NodeIt-t
1.51 +
1.52 +NodeIt bNode(const OutEdgeIt) const;
1.53 +NodeIt bNode(const InEdgeIt) const;
1.54 +NodeIt bNode(const SymEdgeIt) const;
1.55 +az out, in or sym edge iterator nem rogzitett pontjara ad 1 NodeIt-t
1.56 +
1.57 +EachNodeIt first<EachNodeIt>() const;
1.58 +EachEdgeIt first<EachEdgeIt>() const;
1.59 +OutEdgeIt first<OutEdgeIt>(const NodeIt) const;
1.60 +InEdgeIt first<InEdgeIt>(const NodeIt) const;
1.61 +SymEdgeIt first<SymEdgeIt>(const NodeIt) const;
1.62 +EachNodeIt get<EachNodeIt>(const NodeIt) const; ??? konverzio miatt
1.63 +EachEdgeIt get<EachEdgeIt>(const EdgeIt) const; ??? konverzio miatt
1.64 +OutEdgeIt get<OutEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.65 +InEdgeIt get<InEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.66 +SymEdgeIt get<SymEdgeIt>(const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.67 +
1.68 +A masik lehetoseg pedig:
1.69 +
1.70 +void getTail(NodeIt&, const EdgeIt) const;
1.71 +void getHead(NodeIt&, const EdgeIt) const;
1.72 +
1.73 +void getANode(NodeIt&, const OutEdgeIt) const;
1.74 +void getANode(NodeIt&, const InEdgeIt) const;
1.75 +void getANode(NodeIt&, const SymEdgeIt) const;
1.76 +
1.77 +void getBNode(NodeIt&, const OutEdgeIt) const;
1.78 +void getBNode(NodeIt&, const InEdgeIt) const;
1.79 +void getBNode(NodeIt&, const SymEdgeIt) const;
1.80 +
1.81 +void getFirst(EachNodeIt&) const;
1.82 +void getFirst(EachEdgeIt&) const;
1.83 +void getFirst(OutEdgeIt&, const NodeIt) const;
1.84 +void getFirst(InEdgeIt&, const NodeIt) const;
1.85 +void getFirst(SymEdgeIt&, const NodeIt) const;
1.86 +void get(EachNodeIt&, const NodeIt) const; ??? konverzio miatt
1.87 +void get(EachEdgeIt&, const EdgeIt) const; ??? konverzio miatt
1.88 +void get(OutEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.89 +void get(InEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.90 +void get(SymEdgeIt&, const NodeIt, const EdgeIt) const; ??? konverzio miatt
1.91 +
1.92 +Itt er veget az alternativ ize.
1.93 +
1.94 +Pontok azonositasara de meginkabb property vectorokhoz:
1.95 +
1.96 +int id(const NodeIt&) const;
1.97 +int id(const EdgeIt&) const;
1.98 +
1.99 +int nodeNum() const;
1.100 +int edgeNum() const;
1.101 +
1.102 +Pontok es elek hozzaadasanak metodusai:
1.103 +
1.104 +NodeIt addNode();
1.105 +EdgeIt addEdge(const NodeIt, const NodeIt);
1.106 +
1.107 +void deleteNode(const NodeIt);
1.108 +void deleteEdge(const EdgeIt);
1.109 +
1.110 +void setTail(const NodeIt); vagy void setTail(NodeIt); nem tom
1.111 +void setHead(const NodeIt); vagy void setHead(NodeIt); nem tom
1.112 +
1.113 +Hogy konnyebb legyen a progikat tesztelni, nehany stream utasitas:
1.114 +ezek nem a ListGraph metodusai
1.115 +
1.116 +friend std::ostream& operator<<(std::ostream&, const NodeIt&);
1.117 +friend std::ostream& operator<<(std::ostream&, const EdgeIt&);
1.118 +
1.119 +AZ iteratorok leptetesere ket lehetoseg van, az iterator ++ operatora, a
1.120 +masik pedig
1.121 +It G.next(It) const;
1.122 +const G.next(const It) const;
1.123 +It& G.setNext(It&) const; G.goNext(It&) const; G.moveNext(It&) const; mi a jobb szo?
1.124 +
1.125 +Kerdes: A bool valid()-nak ki kell-e jelenteni magarol, hogy const??
1.126 +NodeIt metodusai:
1.127 +NodeIt();
1.128 +bool valid() const;
1.129 +ezek nem tagfuggvenyek:
1.130 +friend bool operator==(const NodeIt&, const NodeIt&);
1.131 +friend bool operator!=(const NodeIt&, const NodeIt&);
1.132 +
1.133 +EachNodeIt metodusai:
1.134 +ez publikusan szarmazik a NodeIt-bol, tehat a fentiek is.
1.135 +EachNodeIt();
1.136 +EachNodeIt& operator++();
1.137 +
1.138 +EdgeIt metodusai:
1.139 +EdgeIt();
1.140 +bool valid() const;
1.141 +ezek nem tagfvek:
1.142 +friend bool operator==(const EdgeIt&, const EdgeIt&);
1.143 +friend bool operator!=(const EdgeIt&, const EdgeIt&);
1.144 +ujra tagfv-ek.
1.145 +
1.146 +EachEdgeIt metodusai:
1.147 +EdgeIt-bol szarmazik
1.148 +EachEdgeIt();
1.149 +EachEdgeIt& operator++();
1.150 +
1.151 +OutEdgeIt metodusai:
1.152 +EdgeIt-bol szarmazik
1.153 +OutEdgeIt();
1.154 +OutEdgeIt& operator++();
1.155 +
1.156 +InEdgeIt metodusai:
1.157 +EdgeIt-bol szarmazik
1.158 +InEdgeIt();
1.159 +InEdgeIt& operator++();
1.160 +
1.161 +SymEdgeIt metodusai:
1.162 +EdgeIt-bol szarmazik
1.163 +SymEdgeIt();
1.164 +SymEdgeIt& operator++();
1.165 +
1.166 +Ami itt kovetkezik az mar nem lenyeg, sot valtozni fog.
1.167 +
1.168 +Node propery array-okrol:
1.169 +
1.170 +template <typename ValueType>
1.171 +class NodeMap;
1.172 +
1.173 +metodusok:
1.174 +
1.175 +NodeMap(const Graph&);
1.176 +NodeMap(const Graph&, const ValueType);
1.177 +void set(Graph::NodeIt, const ValueType);
1.178 +//void put(Graph::NodeIt, const ValueType);
1.179 +ValueType get(Graph::NodeIt) const;
1.180 +
1.181 +Ugyanez edge_property_array-okkal
1.182 +
1.183 +template <typename ValueType>
1.184 +class EdgeMap;
1.185 +
1.186 +EdgeMap(const Graph&);
1.187 +EdgeMap(const Graph&, const ValueType);
1.188 +void set(Graph::EdgeIt, const ValueType);
1.189 +//void put(Graph::EdgeIt, const ValueType);
1.190 +ValueType get(Graph::EdgeIt) const;
1.191 +
1.192 +marci@cs.elte.hu
1.193 \ No newline at end of file