Skip to content

Commit

Permalink
graph/labeled_graph: added remove_labeled_vertex
Browse files Browse the repository at this point in the history
I took this patch from this ticket:
https://svn.boost.org/trac/boost/ticket/9493
  • Loading branch information
George Williams committed Nov 18, 2023
1 parent f315868 commit fa3bf25
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion include/boost/graph/labeled_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ namespace graph_detail
}
//@}

/** @name Remove Labeled Vertex */
//@{
template <typename Container, typename Label, typename Graph>
void remove_labeled_vertex(Container& c, Graph& g, Label const& l)
{
typename Container::iterator c_it = c.find(l);
if (c_it != c.end()) {
boost::remove_vertex(c_it->second, g);
c.erase(c_it);
}
}
//@}

} // namespace detail

struct labeled_graph_class_tag
Expand Down Expand Up @@ -451,7 +464,7 @@ class labeled_graph : protected labeled_graph_types< Graph, Label, Selector >
/** Remove the vertex with the given label. */
void remove_vertex(Label const& l)
{
return boost::remove_vertex(vertex(l), _graph);
return graph_detail::remove_labeled_vertex(_map, _graph, l);
}

/** Return a descriptor for the given label. */
Expand Down

0 comments on commit fa3bf25

Please sign in to comment.