BfsIterator4typename Graph, typename OutEdgeIt,
typename ReachedMap]]>
The class IteratorBfs4 typename Graph, typename OutEdgeIt,
typename ReachedMap]]> 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.
Ez itt egy tobbsoros, tobb reszes leiras arrol, hogy altalanossagban
mire is jo ez az osztaly. Ez itt egy tobbsoros, tobb reszes leiras
arrol, hogy altalanossagban mire is jo ez az osztaly.
Ez itt az uj bekezdese a leirasnak, mert elofordulhat, hogy tobb
bekezdesre erdemes tagolni az iromanyt.
Gyakran hasznos egy peldan bemutatni a mukodest. A kovetkezo egy
egyszeru kis szemleltetes arra, hogy ezt milyen konnyen es gyorsan
lehet hasznalni:
struct eqstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) == 0;
}
};
void lookup(const map_type& Map, const char* str)
{
}
Vigyázat, a programlisting mód parsolt, és minden -t értelmez!
my_edge_property(G);
for(EachEdgeIt i=G.first(); i.valid(); ++i) {
my_edge_property.set(i, _i);
_i*=_ii; ++_ii;
}
]]>
Defined in bfs_iterator.hh.
Ez a definition szekcio arra van, hogy beleirjuk, hogy milyen fajlban
van definialva az aktualis osztaly.
Ez egy link a tutorialra.
Graph
Graph is a graph type which have to satisfy some concept requirements defined at a later date.
Mittomen
Legyen implementalva neki az osszehasonlito operator.
Az nincs
OutEdgeIt
OutEdgeIt is an edge iterator type.
The bfs iterator iterates on the edges.
Az Af template parameter is egy olyan vacak, ami a generikussaghoz kell.
Af szarmazzon az elemi osztalyokbol.
0
ReachedMap
ReachedMap is a map type which stores a bool for each node, and will ne used to maintain the set of reached nodes.
Az Af template parameter is egy olyan vacak, ami a generikussaghoz kell.
Readable and Writable nodemap.
Af szarmazzon az elemi osztalyokbol.
0
BfsIterator4(const Graph& _G, ReachedMap& _reached)
Creates a bfs iterator with empty queue. The reached nodes will be stores in
the map for that _reached refers. Initially, _reached have to be an everywhere
false map. Other cases also can be specified, but due to the difficulty, I have no stomach to deal with it.
BfsIterator4(const Graph& _G)
-
The same as above, but an own map is constructed to store the reached nodes (and is destroyed at the and).
void pushAndSetReached(NodeIt s)
Inserts s in the bfs queue and marks it reached.
BfsIterator4Graph, OutEdgeIt, ReachedMap]]>& operator++()
container
Executes one step on the bfs iterator.
bool finished() const
container
Returns true if and only if the iteration is finished.
operator OutEdgeIt () const
container
This conversion operator returns the actual value of the bfs iterator.
bool isBNodeNewlyReached() const
container
Precondition: OutEdgeIt() returns a valid iterator.
Returns true if and only if bNode of OutEdgeIt() is reached at the last
iteration step.
bool isANodeExamined() const
container
Returns true if and only if the actual node bacomes examined.
NodeIt aNode() const
container
Returns the actual node.
NodeIt bNode() const
container
Precondition: OutEdgeIt() returns a valid iterator.
Returns bNode of the actual edge..
const ReachedMap& getReachedMap() const
container
Const reference to the reached map.
const std::queueNodeIt]]>& getBfsQueue() const
container
Const reference to the bfs queue.