Ticket #7487: trac_7487-review.patch

File trac_7487-review.patch, 1.3 KB (added by mhansen, 11 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Mike Hansen <mhansen@gmail.com>
    # Date 1259660681 28800
    # Node ID 4ee5c41a5bc865522c979ff44f3112545cbbbe4c
    # Parent  684929bc5c5061f29d85b60058c7e476925314d3
    [mq]: trac_7487-review.patch
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    33763376        As for any interval graph, the chromatic number is equal to
    33773377        the clique number ::
    33783378
    3379             sage: g = graphs.RandomInterval(15)
     3379            sage: g = graphs.RandomInterval(8)
    33803380            sage: g.clique_number() == g.chromatic_number()
    33813381            True
    33823382
     
    33913391
    33923392        from sage.misc.prandom import random
    33933393
    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()
    33973396        edges = []
    33983397        while intervals:
    33993398            x = intervals.pop()
     
    34023401                    edges.append((x,y))
    34033402                else:
    34043403                    break
    3405         g=graph.Graph(vertices=intervals)
     3404        g = graph.Graph(vertices=intervals)
    34063405        g.add_edges(edges)
    34073406        return g
    34083407