Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Boost Graph Library: predecessor_recorder

Boost , ,

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

C++ Boost

predecessor_recorder<PredecessorMap, EventTag>

This is an EventVisitor that records the predecessor (or parent) of a vertex in a predecessor property map. This is particularly useful in graph search algorithms where recording the predecessors is an efficient way to encode the search tree that was traversed during the search. The predecessor recorder is typically used with the on_tree_edge or on_relax_edge events and cannot be used with vertex events.

predecessor_recorder can be used with graph algorithms by wrapping it with an algorithm-specific adaptor, such as bfs_visitor and dfs_visitor. Also, this event visitor can be combined with other event visitors using std::pair to form an EventVisitorList.

Algorithms such as Dijkstra's and breadth-first search will not assign a predecessor to the source vertex (which is the root of the search tree). It is often useful to initialize the source vertex's predecessor to itself, thereby identifying the root vertex as the only vertex which is its own parent. When using an algorithm like depth-first search that creates a forest (multiple search trees) it is useful to initialize the predecessor of every vertex to itself. This way all the root nodes can be distinguished.

Example

See the example for bfs_visitor.

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
Карта предшественника AWritablePropertyMap, где ключевым типом и типом значения является тип дескриптора вершины графика.  
Тег события Тег для указания, когдапредшественник_рекордердолжен быть применен во время алгоритма графа.Тег событиядолжен быть краевым событием.  

Associated Types

TypeDescription
Предшественник_запись::событие_фильтр Это будет тот же тип, что и параметр шаблонаEventTag.

Member Functions

MemberDescription
предшественник_рекордер (PredecessorMap pa); Постройте объект регистратора предшественника с картой свойств предшественникаpa.
шаблон
void operator()(Edge e, const Graph&g);
е = (u,v), эта записьув качестве предшественника (или родителя)v.

Non-Member Functions

FunctionDescription
template
predecessor_recorder
record_predecessors(PredecessorMap pa, Tag);
Удобный способ созданияпредшественницы.

See Also

Visitor concepts

The following are other event visitors: distance_recorder, time_stamper, and property_writer.


Copyright © 2000-2001Джереми Сик, Университет Индианыjsiek@osl.iu.edu]
Ли-Куан Ли, Университет Индианыllee@cs.indiana.edu]
Эндрю Лумсдейн, Университет Индианыlums@osl.iu.edu

Статья Boost Graph Library: predecessor_recorder раздела может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-07-05 11:28:52/0.0063729286193848/0