本文整理汇总了C++中Visitor::next_edge方法的典型用法代码示例。如果您正苦于以下问题:C++ Visitor::next_edge方法的具体用法?C++ Visitor::next_edge怎么用?C++ Visitor::next_edge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visitor
的用法示例。
在下文中一共展示了Visitor::next_edge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: planar_face_traversal
void planar_face_traversal(const Graph& g,
PlanarEmbedding embedding,
Visitor& visitor, EdgeIndexMap em
)
{
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef typename graph_traits<Graph>::edge_descriptor edge_t;
typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t;
typedef typename graph_traits<Graph>::edge_iterator edge_iterator_t;
typedef typename
property_traits<PlanarEmbedding>::value_type embedding_value_t;
typedef typename embedding_value_t::const_iterator embedding_iterator_t;
typedef typename
std::vector< std::set<vertex_t> > distinguished_edge_storage_t;
typedef typename
std::vector< std::map<vertex_t, edge_t> >
distinguished_edge_to_edge_storage_t;
typedef typename
boost::iterator_property_map
<typename distinguished_edge_storage_t::iterator, EdgeIndexMap>
distinguished_edge_map_t;
typedef typename
boost::iterator_property_map
<typename distinguished_edge_to_edge_storage_t::iterator, EdgeIndexMap>
distinguished_edge_to_edge_map_t;
distinguished_edge_storage_t visited_vector(num_edges(g));
distinguished_edge_to_edge_storage_t next_edge_vector(num_edges(g));
distinguished_edge_map_t visited(visited_vector.begin(), em);
distinguished_edge_to_edge_map_t next_edge(next_edge_vector.begin(), em);
vertex_iterator_t vi, vi_end;
typename std::vector<edge_t>::iterator ei, ei_end;
edge_iterator_t fi, fi_end;
embedding_iterator_t pi, pi_begin, pi_end;
visitor.begin_traversal();
// Initialize the next_edge property map. This map is initialized from the
// PlanarEmbedding so that get(next_edge, e)[v] is the edge that comes
// after e in the clockwise embedding around vertex v.
for(boost::tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi)
{
vertex_t v(*vi);
pi_begin = embedding[v].begin();
pi_end = embedding[v].end();
for(pi = pi_begin; pi != pi_end; ++pi)
{
edge_t e(*pi);
std::map<vertex_t, edge_t> m = get(next_edge, e);
m[v] = boost::next(pi) == pi_end ? *pi_begin : *boost::next(pi);
put(next_edge, e, m);
}
}
// Take a copy of the edges in the graph here, since we want to accomodate
// face traversals that add edges to the graph (for triangulation, in
// particular) and don't want to use invalidated edge iterators.
// Also, while iterating over all edges in the graph, we single out
// any self-loops, which need some special treatment in the face traversal.
std::vector<edge_t> self_loops;
std::vector<edge_t> edges_cache;
std::vector<vertex_t> vertices_in_edge;
for(boost::tie(fi,fi_end) = edges(g); fi != fi_end; ++fi)
{
edge_t e(*fi);
edges_cache.push_back(e);
if (source(e,g) == target(e,g))
self_loops.push_back(e);
}
// Iterate over all edges in the graph
ei_end = edges_cache.end();
for(ei = edges_cache.begin(); ei != ei_end; ++ei)
{
edge_t e(*ei);
vertices_in_edge.clear();
vertices_in_edge.push_back(source(e,g));
vertices_in_edge.push_back(target(e,g));
typename std::vector<vertex_t>::iterator vi, vi_end;
vi_end = vertices_in_edge.end();
//Iterate over both vertices in the current edge
for(vi = vertices_in_edge.begin(); vi != vi_end; ++vi)
{
vertex_t v(*vi);
std::set<vertex_t> e_visited = get(visited, e);
typename std::set<vertex_t>::iterator e_visited_found
= e_visited.find(v);
//.........这里部分代码省略.........