// Write a function delete_edge( g, u, v ) that uses v.erase with // std::find to delete an edge from the edge_list inline void delete_edge( edge_list& g, vertex_id u, vertex_id v ) { edge e(u,v); std::pair<edge_list::iterator,edge_list::iterator> p = std::equal_range( g.begin(), g.end(), e ); g.erase( p.first, p.second ); }
bound() noexcept : edges(), current_edge(edges.end()), next_edge(edges.end()), last_point({ 0, 0 }), ring(nullptr), maximum_bound(nullptr), current_x(0.0), pos(0), winding_count(0), winding_count2(0), winding_delta(0), poly_type(polygon_type_subject), side(edge_left) { }
// True iff there is an edge in g from u to v // Complexity: O( log(|E|) ) inline bool has_edge(edge_list const& g, int u, int v) { return std::binary_search( g.begin(), g.end(), edge(u,v) ); }
// Add an edge in g from u to v with weight w // Complexity: O( log(|V|) ) // Requires: u is a vertex in g, i.e. u < count_vertices( g ) inline void add_edge( edge_list& g, vertex_id u, vertex_id v ) { edge e(u,v); g.insert( std::lower_bound( g.begin(), g.end(), e ), e ); }
inline void delete_self_loops( edge_list& g ) { for ( edge_list::iterator p = g.begin(), e = g.end(); p != e; ++p ) if ( p->first == p->second ) p = g.erase(p); }