Opened 17 years ago

Closed 17 years ago

#550 closed Bugs (Invalid)

Getting out edges for empty graph cause access violation.

Reported by: nobody Owned by: jsiek
Milestone: Component: graph
Version: None Severity:
Keywords: Cc:

Description

Getting out edges for empty graph cause access 
violation, see example below:

#include <boost/graph/adjacency_list.hpp>

using namespace boost;

typedef boost::adjacency_list<boost::vecS, 
boost::vecS, boost::bidirectionalS> Graph;
typedef boost::graph_traits<Graph>::in_edge_iterator 
InEdgeIterator;
typedef boost::graph_traits<Graph>::out_edge_iterator 
OutEdgeIterator;
typedef boost::graph_traits<Graph>::vertex_descriptor 
Vertex;

int main()
{
	Graph g;
	Vertex CurrVertex =	vertex(10,	g);

	OutEdgeIterator	in_start, in_end;
	tie(in_start, in_end) =	out_edges(CurrVertex, 
g);

	return 0;
}


Change History (1)

comment:1 by Douglas Gregor, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=249098

This is not a bug. The call to vertex(10, g) is ill-formed for any graph with 
fewer than 11 vertices, so the resulting vertex descriptor "CurrVertex" is 
invalid. out_edges is not defined for invalid vertex descriptors.
Note: See TracTickets for help on using tickets.