# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1319210935 7200
# Node ID 19f096fe24a2280948e4d4486341f9e81744f177
# Parent d740726a92bc0eef8e372e0a59c37b6cdf0a84b0
trac #11942  segfault on Graph().connected_component_containing_vertex('')
diff git a/sage/graphs/base/c_graph.pyx b/sage/graphs/base/c_graph.pyx
a

b


3318  3318  sage: g = graphs.PetersenGraph() 
3319  3319  sage: list(g.breadth_first_search(0)) 
3320  3320  [0, 1, 4, 5, 2, 6, 3, 9, 7, 8] 
 3321  
 3322  TEST: 
 3323  
 3324  A vertex which does not belong to the graph:: 
 3325  
 3326  sage: list(g.breadth_first_search(9)) 
 3327  Traceback (most recent call last): 
 3328  ... 
 3329  ValueError: The given vertex is not an element of the graph ! 
 3330  
 3331  An empty graph:: 
 3332  
 3333  sage: list(Graph().breadth_first_search('')) 
 3334  Traceback (most recent call last): 
 3335  ... 
 3336  ValueError: The given vertex is not an element of the graph ! 
3321  3337  """ 
3322  3338  self.graph = graph 
3323  3339  self.direction = direction 
… 
… 

3325  3341  bitset_init(self.seen, (<CGraph>self.graph._cg).active_vertices.size) 
3326  3342  bitset_set_first_n(self.seen, 0) 
3327  3343  
3328   self.stack = [get_vertex(v, 
 3344  cdef int v_id = get_vertex(v, 
3329  3345  self.graph.vertex_ints, 
3330  3346  self.graph.vertex_labels, 
3331   self.graph._cg)] 
 3347  self.graph._cg) 
 3348  
 3349  if v_id == 1: 
 3350  raise ValueError("The given vertex is not an element of the graph !") 
 3351  
 3352  self.stack = [v_id] 
3332  3353  
3333  3354  if not self.graph.directed: 
3334  3355  ignore_direction = False 