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

Boost Graph Library: Isomorphism

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

(Python) isomorphism

// named parameter version
template <class Graph1, class Graph2, class P, class T, class R>
bool isomorphism(const Graph1& g1, const Graph2& g2,
                 const bgl_named_params<P,T,R>& params = all defaults)
// non-named parameter version
template <typename Graph1, typename Graph2, typename IsoMap, 
          typename VertexInvariant1, typename VertexInvariant2, 
          typename V1Map, typename V2Map>
bool isomorphism(const Graph1& g1, const Graph2& g2,
		 IsoMap f, VertexInvariant1 invariant2, VertexInvariant2 invariant2,
		 std::size_t max_invariant, VertexIndex1Map i1_map, VertexIndex2Map i2_map)

изоморфизмпредставляет собой отображение вершин от 1 до 1 в одном графе к вершинам другого графа таким образом, что сохраняется смежность. Другие слова, приведенные в графахG1= (V1,E1)иG2= (V2,E2)изоморфизм — функцияf, такая, что для всех пар вершинa, binV1, edge(a,b)вE1если и только если край(f(a),f(b))вE2.

Эта функция возвращаетистинное, если существует изоморфизм между графом 1 и графом 2 иложноев противном случае. Кроме того, если предоставлена карта изоморфизма, называемая параметром, то на карте записывается изоморфизм.

Текущая реализация основана на описаниях алгоритма обратного отслеживания в46,48. Файл?tid=3761содержит (несколько устаревшее) "грамотное" описание реализации. Используемый алгоритм простой, но медленный. Более эффективный (и гораздо более сложный) алгоритм описан в47. Когда (и если) версия этого алгоритма портируется на интерфейс BGL, она должна заменить текущий алгоритм.

Where Defined

boost/graph/isomorphism.hpp

Parameters

IN: const Graph1& g1
A directed or undirected graph. The graph type must model of Vertex List Graph and Edge List Graph.
IN: const Graph2& g2
A directed or undirected graph. The graph type must model Bidirectional Graph and Vertex List Graph.

Named Parameters

OUT: isomorphism_map(IsoMap f)
The mapping from vertices in graph 1 to vertices in graph 2. This must be a Read/Write Property Map.
Default: an iterator_property_map constructed from a std::vector of graph 2's vertex descriptor type and the vertex index map for graph 1.
Python: Must be a vertex_vertex_map for the first graph.
IN: vertex_invariant1(VertexInvariant1 i1) IN: vertex_invariant2(VertexInvariant2 i2)
Mappings from vertices to integers which restrict which vertices may be considered isomorphic. If a candidate isomorphism maps v1 to v2 but i1(v1) != i2(v2), that candidate is rejected. This mapping can be used either to speed up the search (as is done by the default value, which requires that the degrees of v1 and v2 are equal) or to impose extra conditions on the result. The VertexInvariant1 and VertexInvariant2 types must model UnaryFunction, with the argument type of vertex_invariant1 being Graph1's vertex descriptor type, the argument type of vertex_invariant2 being Graph2's vertex descriptor type, and both functions having integral result types. The values returned by these two functions must be in the range [0, vertex_max_invariant).
Default: degree_vertex_invariant for both arguments
Python: Unsupported parameter.
IN: vertex_max_invariant(std::size_t max_invariant)
An upper bound on the possible values returned from either vertex_invariant1 or vertex_invariant2.
Default: vertex_invariant2.max(). The default vertex_invariant2 parameter, an instance of degree_vertex_invariant, defines this function to return num_vertices(g2) * (num_vertices(g2)+1).
Python: Unsupported parameter.
IN: vertex_index1_map(VertexIndex1Map i1_map)
This maps each vertex to an integer in the range [0, num_vertices(g)). This is necessary for efficient updates of the heap data structure when an edge is relaxed. The type VertexIndex1Map must be a model of Readable Property Map. The value type of the map must be an integer type. The vertex descriptor type of graph 1 needs to be usable as the key type of the map.
Default: get(vertex_index, g1) Note: if you use this default, make sure your graph has an internal vertex_index property. For example, adjacency_list with VertexList=listS does not have an internal vertex_index property.
Python: Unsupported parameter.
IN: vertex_index2_map(VertexIndex2Map i2_map)
This maps each vertex to an integer in the range [0, num_vertices(g)). This is necessary for efficient updates of the heap data structure when an edge is relaxed. The type VertexIndex2Map must be a model of Readable Property Map. The value type of the map must be an integer type. The vertex descriptor type of graph 2 needs to be usable as the key type of the map.
Default: get(vertex_index, g2) Note: if you use this default, make sure your graph has an internal vertex_index property. For example, adjacency_list with VertexList=listS does not have an internal vertex_index property.
Python: Unsupported parameter.

Complexity

The worst-case time complexity is O(|V|!).

Example

See libs/graph/example/isomorphism.cpp.

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

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




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



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


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-05-21 06:28:23/0.0038948059082031/0