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