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

AdjacencyGraph

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

AdjacencyGraph

The AdjacencyGraph concept provides and interface for efficient access of the adjacent vertices to a vertex in a graph. This is quite similar to the IncidenceGraph concept (the target of an out-edge is an adjacent vertex). Both concepts are provided because in some contexts there is only concern for the vertices, whereas in other contexts the edges are also important.

Refinement of

Graph

Notation

G Тип, который является моделью графа.
г Объект типаG.
против Объект типаboost::graph_traits::vertex_descriptor.

Associated Types

boost::graph_traits::traversal_category

Этот тип тега должен быть конвертируемым вadjacency_graph_tag.
<
boost::graph_traits<G>::adjacency_iterator
>Итератор смежности для вершиныvобеспечивает доступ к вершинам, прилегающим кv. Таким образом, тип значения итератора смежности является типом дескриптора вершины его графика. Итератор смежности должен соответствовать требованиямMultiPassInputIterator.

Valid Expressions

adjacent_vertices(v, g) Возвращает итератор-диапазон, обеспечивающий доступ к вершинам, прилегающим к вершинеvна графикеg
Тип возврата:std::pair

Complexity guarantees

The adjacent_vertices() function must return in constant time.

See Also

Graph concepts, adjacency_iterator

Concept Checking Class

  template <class G>
  struct AdjacencyGraphConcept
  {
    typedef typename boost::graph_traits<G>::adjacency_iterator
      adjacency_iterator;
    void constraints() {
      BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<adjacency_iterator> ));
      p = adjacent_vertices(v, g);
      v = *p.first;
      const_constraints(g);
    }
    void const_constraints(const G& g) {
      p = adjacent_vertices(v, g);
    }
    std::pair<adjacency_iterator,adjacency_iterator> p;
    typename boost::graph_traits<G>::vertex_descriptor v;
    G g;
  };

Design Rationale

The AdjacencyGraph concept is somewhat frivolous since IncidenceGraph really covers the same functionality (and more). The AdjacencyGraph concept exists because there are situations when adjacent_vertices() is more convenient to use than out_edges(). If you are constructing a graph class and do not want to put in the extra work of creating an adjacency iterator, have no fear. There is an adaptor class named adjacency_iterator that you can use to create an adjacency iterator out of an out-edge iterator.

Notes

[1] The case of a multigraph (where multiple edges can connect the same two vertices) brings up an issue as to whether the iterators returned by the adjacent_vertices() function access a range that includes each adjacent vertex once, or whether it should match the behavior of the out_edges() function, and access a range that may include an adjacent vertex more than once. For now the behavior is defined to match that of out_edges(), though this decision may need to be reviewed in light of more experience with graph algorithm implementations.

Copyright © 2000-2001Джереми Сик, Университет Индианыjsiek@osl.iu.edu

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




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



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


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 02:20:19/0.0051941871643066/1