A undirected graph G is connected if, for every pair of vertices
u,v in G, there is a path from u to v.
make_connected adds the minimum number of edges needed to make the
input graph connected. The algorithm first identifies all of the
connected components in the graph,
then adds edges to connect those components together in a path. For example, if
a graph contains three connected components A, B, and C,
make_connected will add two edges. The two edges added might consist
of one connecting a vertex in A with a vertex in B and one
connecting a vertex in B with a vertex in C.
The default behavior of make_connected is to modify the graph
g by calling add_edge(u,v,g) for every pair of vertices
(u,v) where an edge needs to be added to connect g. This
behavior can be overriden by providing a vistor as the AddEdgeVisitor
parameter. The only requirement for an AddEdgeVisitor is that it
define a member function with the following signature:
This event point can also be used as a hook to update the underlying edge
index map automatically as edges are added. See the
documentation for the AddEdgeVisitor
concept for more information.
Статья Boost Graph Library: make_connected раздела может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.