doc-docbook/src/xml/search_iterator.xml
author marci
Mon, 22 Mar 2004 13:08:24 +0000
changeset 231 f62f11c9e6df
parent 153 7309f1b3fc47
permissions -rw-r--r--
.
     1 <etik:class>
     2  <etik:name> 
     3   BfsIterator4<![CDATA[<]]>typename Graph, typename OutEdgeIt, 
     4 	    typename ReachedMap<![CDATA[>]]>
     5  </etik:name>
     6 
     7  <etik:description>
     8 The class IteratorBfs4 <![CDATA[<]]>typename Graph, typename OutEdgeIt, 
     9 	    typename ReachedMap<![CDATA[>]]> implements an edge iterator which iterates on the edges of a directed or undirected graph in a breadth first search order. As a bare iterator, it stores the actual edge, the bfs queue and the map of reached nodes. The usual interpretation of bfs consists of computing auxiliary quantities i.e. distance from root or tree of edges on which the reachable nodes were reached. This iterator approach entrusts such functionalities to the user, they have to be implemented out of the class. 
    10  Ez itt egy tobbsoros, tobb reszes leiras arrol, hogy altalanossagban
    11  mire is jo ez az osztaly.  Ez itt egy tobbsoros, tobb reszes leiras
    12  arrol, hogy altalanossagban mire is jo ez az osztaly.
    13 <para>
    14  Ez itt az uj bekezdese a leirasnak, mert elofordulhat, hogy tobb
    15  bekezdesre erdemes tagolni az iromanyt.
    16 </para>
    17  </etik:description>
    18 
    19  <etik:example>
    20   Gyakran hasznos egy peldan bemutatni a mukodest. A kovetkezo egy
    21   egyszeru kis szemleltetes arra, hogy ezt milyen konnyen es gyorsan
    22   lehet hasznalni:
    23 <programlisting>
    24 
    25 struct eqstr
    26 {
    27   bool operator()(const char* s1, const char* s2) const
    28   {
    29     return strcmp(s1, s2) == 0;
    30   }
    31 };
    32 
    33 void lookup(const map_type& Map, const char* str)
    34 {
    35 
    36 }
    37 
    38 </programlisting>
    39 
    40 Vigyázat, a programlisting mód parsolt, és minden <![CDATA[<]]>-t értelmez!
    41 
    42 <etik:code>
    43 <![CDATA[
    44   int _i=1;
    45   int _ii=1;
    46   ListGraph::EdgeMap<int> my_edge_property(G);
    47   for(EachEdgeIt i=G.first<EachEdgeIt>(); i.valid(); ++i) {
    48     my_edge_property.set(i, _i);
    49     _i*=_ii; ++_ii;
    50   }
    51 ]]>
    52 </etik:code>
    53 </etik:example>
    54 
    55  <etik:definition>
    56 Defined in bfs_iterator.hh.
    57 Ez a definition szekcio arra van, hogy beleirjuk, hogy milyen fajlban
    58 van definialva az aktualis osztaly.
    59 Ez <xref linkend="tutorial"/> egy link a tutorialra.
    60  </etik:definition>
    61 
    62 <etik:template_params>
    63 <etik:template_param>
    64 <etik:templ_name>
    65 Graph
    66 </etik:templ_name>
    67 <etik:templ_description>
    68 Graph is a graph type which have to satisfy some concept requirements defined at a later date.
    69 </etik:templ_description>
    70 <etik:templ_requirement>
    71 Mittomen
    72 Legyen implementalva neki az osszehasonlito operator.
    73 </etik:templ_requirement>
    74 <etik:templ_default>
    75 Az nincs
    76 </etik:templ_default>
    77 </etik:template_param>
    78 <etik:template_param>
    79 <etik:templ_name>
    80 OutEdgeIt
    81 </etik:templ_name>
    82 <etik:templ_description>
    83 OutEdgeIt is an edge iterator type. 
    84 The bfs iterator iterates on the edges.
    85 Az Af template parameter is egy olyan vacak, ami a generikussaghoz kell.
    86 </etik:templ_description>
    87 <etik:templ_requirement>
    88 Af szarmazzon az elemi osztalyokbol.
    89 </etik:templ_requirement>
    90 <etik:templ_default>
    91 0
    92 </etik:templ_default>
    93 </etik:template_param>
    94 <etik:template_param>
    95 <etik:templ_name>
    96 ReachedMap
    97 </etik:templ_name>
    98 <etik:templ_description>
    99 ReachedMap is a map type which stores a bool for each node, and will ne used to maintain the set of reached nodes.
   100 Az Af template parameter is egy olyan vacak, ami a generikussaghoz kell.
   101 </etik:templ_description>
   102 <etik:templ_requirement>
   103 Readable and Writable nodemap.
   104 Af szarmazzon az elemi osztalyokbol.
   105 </etik:templ_requirement>
   106 <etik:templ_default>
   107 0
   108 </etik:templ_default>
   109 </etik:template_param>
   110 </etik:template_params>
   111 
   112 
   113 <etik:members>
   114 
   115 <etik:member>
   116 <etik:m_name>
   117 BfsIterator4(const Graph& _G, ReachedMap& _reached)
   118 </etik:m_name>
   119 <etik:m_where_def>
   120 
   121 </etik:m_where_def>
   122 <etik:m_description>
   123 Creates a bfs iterator with empty queue. The reached nodes will be stores in 
   124 the map for that _reached refers. Initially, _reached have to be an everywhere 
   125 false map. Other cases also can be specified, but due to the difficulty, I have no stomach to deal with it.
   126 </etik:m_description>
   127 
   128 </etik:member>
   129 
   130 <etik:member>
   131 <etik:m_name>
   132 BfsIterator4(const Graph& _G)
   133 </etik:m_name>
   134 <etik:m_where_def>
   135 -
   136 </etik:m_where_def>
   137 <etik:m_description>
   138 The same as above, but an own map is constructed to store the reached nodes (and is destroyed at the and). 
   139 </etik:m_description>
   140 
   141 </etik:member>
   142 
   143 <etik:member>
   144 <etik:m_name>
   145 void pushAndSetReached(NodeIt s) 
   146 </etik:m_name>
   147 <etik:m_where_def>
   148 
   149 </etik:m_where_def>
   150 <etik:m_description>
   151 Inserts s in the bfs queue and marks it reached.
   152 </etik:m_description>
   153 
   154 </etik:member>
   155 
   156 <etik:member>
   157 <etik:m_name>
   158 BfsIterator4<![CDATA[<]]>Graph, OutEdgeIt, ReachedMap<![CDATA[>]]>& operator++()
   159 </etik:m_name>
   160 <etik:m_where_def>
   161 container
   162 </etik:m_where_def>
   163 <etik:m_description>
   164 Executes one step on the bfs iterator.
   165 </etik:m_description>
   166 
   167 </etik:member>
   168 
   169 <etik:member>
   170 <etik:m_name>
   171 bool finished() const
   172 </etik:m_name>
   173 <etik:m_where_def>
   174 container
   175 </etik:m_where_def>
   176 <etik:m_description>
   177 Returns true if and only if the iteration is finished.
   178 </etik:m_description>
   179 
   180 </etik:member>
   181 
   182 <etik:member>
   183 <etik:m_name>
   184 operator OutEdgeIt () const
   185 </etik:m_name>
   186 <etik:m_where_def>
   187 container
   188 </etik:m_where_def>
   189 <etik:m_description>
   190 This conversion operator returns the actual value of the bfs iterator.
   191 </etik:m_description>
   192 
   193 </etik:member>
   194 
   195 <etik:member>
   196 <etik:m_name>
   197 bool isBNodeNewlyReached() const
   198 </etik:m_name>
   199 <etik:m_where_def>
   200 container
   201 </etik:m_where_def>
   202 <etik:m_description>
   203 Precondition: OutEdgeIt() returns a valid iterator.
   204 Returns true if and only if bNode of OutEdgeIt() is reached at the last 
   205 iteration step.
   206 </etik:m_description>
   207 
   208 </etik:member>
   209 
   210 <etik:member>
   211 <etik:m_name>
   212 bool isANodeExamined() const
   213 </etik:m_name>
   214 <etik:m_where_def>
   215 container
   216 </etik:m_where_def>
   217 <etik:m_description>
   218 Returns true if and only if the actual node bacomes examined.
   219 </etik:m_description>
   220 
   221 </etik:member>
   222 
   223 <etik:member>
   224 <etik:m_name>
   225 NodeIt aNode() const
   226 </etik:m_name>
   227 <etik:m_where_def>
   228 container
   229 </etik:m_where_def>
   230 <etik:m_description>
   231 Returns the actual node.
   232 </etik:m_description>
   233 
   234 </etik:member>
   235 
   236 <etik:member>
   237 <etik:m_name>
   238 NodeIt bNode() const
   239 </etik:m_name>
   240 <etik:m_where_def>
   241 container
   242 </etik:m_where_def>
   243 <etik:m_description>
   244 Precondition: OutEdgeIt() returns a valid iterator.
   245 Returns bNode of the actual edge..
   246 </etik:m_description>
   247 
   248 </etik:member>
   249 
   250 <etik:member>
   251 <etik:m_name>
   252 const ReachedMap& getReachedMap() const
   253 </etik:m_name>
   254 <etik:m_where_def>
   255 container
   256 </etik:m_where_def>
   257 <etik:m_description>
   258 Const reference to the reached map.
   259 </etik:m_description>
   260 
   261 </etik:member>
   262 
   263 <etik:member>
   264 <etik:m_name>
   265 const std::queue<![CDATA[<]]>NodeIt<![CDATA[>]]>& getBfsQueue() const
   266 </etik:m_name>
   267 <etik:m_where_def>
   268 container
   269 </etik:m_where_def>
   270 <etik:m_description>
   271 Const reference to the bfs queue.
   272 </etik:m_description>
   273 
   274 </etik:member>
   275 
   276 
   277 </etik:members>
   278 
   279 
   280 
   281 
   282 </etik:class>
   283 
   284 
   285 <!-- Keep this comment at the end of the file
   286 Local variables:
   287 mode: xml
   288 sgml-omittag:nil
   289 sgml-shorttag:nil
   290 sgml-namecase-general:nil
   291 sgml-general-insert-case:lower
   292 sgml-minimize-attributes:nil
   293 sgml-always-quote-attributes:t
   294 sgml-indent-step:2
   295 sgml-indent-data:nil
   296 sgml-parent-document:("graph-classes.xml" "sect1" "etik:class")
   297 sgml-exposed-tags:nil
   298 sgml-local-catalogs:nil
   299 sgml-local-ecat-files:nil
   300 End:
   301 -->