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