[BGL] filtered graph missing vertex function

is there a particular reason that the filtered graph is missing a vertex_descriptor vertex(vertices_size_type, const& filtered_graph) function? of course this would return exactly the same as the one of the underlying graph, nevertheless it would be handy for code treating filtered graphs the same way as normal ones. greetings moritz

Hi Moritz,
2006/9/5, moritz Hilger
is there a particular reason that the filtered graph is missing a vertex_descriptor vertex(vertices_size_type, const& filtered_graph) function? of course this would return exactly the same as the one of the underlying graph, nevertheless it would be handy for code treating filtered graphs the same way as normal ones.
I think the problem here is the return value of the function. If you have a VertexPredicate set, it would be possible that the vertex you specify through the index doesn't exist in the filtered graph. Maybe a null_vertex() could be returned in that case (But, IIRC, that null_vertex() doesn't exist in every graph). Cheers, Stephan

On 9/5/06, Stephan Diederich
Hi Moritz,
2006/9/5, moritz Hilger
: - Zitierten Text anzeigen - is there a particular reason that the filtered graph is missing a vertex_descriptor vertex(vertices_size_type, const& filtered_graph) function? of course this would return exactly the same as the one of the underlying graph, nevertheless it would be handy for code treating filtered graphs the same way as normal ones.
I think the problem here is the return value of the function. If you have a VertexPredicate set, it would be possible that the vertex you specify through the index doesn't exist in the filtered graph. Maybe a null_vertex() could be returned in that case (But, IIRC, that null_vertex() doesn't exist in every graph).
hmm, the null_vertex() function is part of the graph concept ( http://www.boost.org/libs/graph/doc/Graph.html) and should return "a special boost::graph_traits<G>::vertex_descriptor object which does not refer to any vertex of graph object which type is G." so why not return this if the VertexPredicate excludes the requested vertex? cheers, moritz

2006/9/6, moritz Hilger
On 9/5/06, Stephan Diederich
wrote: Hi Moritz,
2006/9/5, moritz Hilger
: - Zitierten Text anzeigen - is there a particular reason that the filtered graph is missing a vertex_descriptor vertex(vertices_size_type, const& filtered_graph) function? of course this would return exactly the same as the one of the underlying graph, nevertheless it would be handy for code treating filtered graphs the same way as normal ones.
I think the problem here is the return value of the function. If you have a VertexPredicate set, it would be possible that the vertex you specify through the index doesn't exist in the filtered graph. Maybe a null_vertex() could be returned in that case (But, IIRC, that null_vertex() doesn't exist in every graph).
hmm, the null_vertex() function is part of the graph concept (http://www.boost.org/libs/graph/doc/Graph.html) and should return "a special boost::graph_traits<G>::vertex_descriptor object which does not refer to any vertex of graph object which type is G." so why not return this if the VertexPredicate excludes the requested vertex?
Yes, I'd vote for that, too. But after that, you have to check each vertex(vertices_size_type, const& filtered_graph) call for a returned null_vertex which you normally don't want to do if you have a "proper" graph. But at least it makes it a bit nicer to work with a filtered graph. Cheers, Stephan
participants (2)
-
moritz Hilger
-
Stephan Diederich