Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Checking if a vertex_descriptor is valid
From: Florian.PONROY_at_[hidden]
Date: 2009-04-01 09:19:34


Hi,

I want to check if a vertex_descriptor is valid before using it. As I saw on
this list, I perform the following test :

        Graph_t graph(10);

        vertexDescriptor srcVertex = boost::vertex(424242, graph);

        if (Graph_t::null_vertex() == boost::vertex(424242, graph))
        {
                return;
        }

Obviously, vertex indice 424242 does not exist, but test fails, and function
does not return, leading the a crash of the following algorithm (BFS or
Dijkstra).

What did I do wrong?

Thanks for your help.

-- 
Florian PONROY
Thales Land & Joint France
Tel. : +33(0)1 41 304 363
Fax : +33(0)1 41 303 560
Email : florian.ponroy_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net