Provides iterators to iterate over the out-going edges of node u
from graph g
, e.g.:
typename graph_traits < Graph >::out_edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) {
auto source = boost::source ( *ei, g );
auto target = boost::target ( *ei, g );
std::cout << "There is an edge from " << source << " to " << target << std::endl;
}
where Graph
is your type definition of the graph an g
is an instance of that. However, out_edges
is only applicable for graphs with directed edges. The opposite of out_edges
is in_edges
that provides you iterators to compute in-coming edges of a node.
In an undirected graph both out_edges
and in_edges
will return all the edges connecting to the node in question.
However, more information can be easily found on http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/graph_concepts.html or just in the Boost.Graph examples/tests.