# HG changeset patch
# User Mike Hansen <mhansen@gmail.com>
# Date 1259660681 28800
# Node ID 4ee5c41a5bc865522c979ff44f3112545cbbbe4c
# Parent 684929bc5c5061f29d85b60058c7e476925314d3
[mq]: trac_7487review.patch
diff git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
a

b


3376  3376  As for any interval graph, the chromatic number is equal to 
3377  3377  the clique number :: 
3378  3378  
3379   sage: g = graphs.RandomInterval(15) 
 3379  sage: g = graphs.RandomInterval(8) 
3380  3380  sage: g.clique_number() == g.chromatic_number() 
3381  3381  True 
3382  3382  
… 
… 

3391  3391  
3392  3392  from sage.misc.prandom import random 
3393  3393  
3394   s = lambda x,y : (x,y) if x<=y else (y,x) 
3395   intervals = [s(random(), random()) for i in range(n)] 
3396   intervals.sort(key=lambda x:x[0]) 
 3394  intervals = [tuple(sorted((random(), random()))) for i in range(n)] 
 3395  intervals.sort() 
3397  3396  edges = [] 
3398  3397  while intervals: 
3399  3398  x = intervals.pop() 
… 
… 

3402  3401  edges.append((x,y)) 
3403  3402  else: 
3404  3403  break 
3405   g=graph.Graph(vertices=intervals) 
 3404  g = graph.Graph(vertices=intervals) 
3406  3405  g.add_edges(edges) 
3407  3406  return g 
3408  3407  