Ticket #13808: trac_13808-combinations.patch

File trac_13808-combinations.patch, 1.4 KB (added by dcoudert, 8 years ago)
  • sage/graphs/hyperbolicity.pyx

    # HG changeset patch
    # User dcoudert <david.coudert@inria.fr>
    # Date 1357168829 -3600
    # Node ID 77bc622f946ced0ce818727c97d7a549ad256dc5
    # Parent  e27261c504d051224740d33cea91baf74b947d0a
    trac #13808 -- combinations patch
    
    diff --git a/sage/graphs/hyperbolicity.pyx b/sage/graphs/hyperbolicity.pyx
    a b  
    368368    for u,v in G.edge_iterator(labels=None):
    369369        ggnx.add_edge(u,v)
    370370
    371     from sage.combinat.combinat import combinations_iterator
     371    from sage.combinat.combination import Combinations
    372372    cdef list elim = []
    373373    cdef set L = set()
    374374
     
    383383        # update the list of vertices of degree at most max_degree.
    384384        u = L.pop()
    385385        X = ggnx.neighbors(u)
    386         if all(ggnx.has_edge(v,w) for v,w in combinations_iterator(X,2)):
     386        if all(ggnx.has_edge(v,w) for v,w in Combinations(X,2).list()):
    387387            elim.append(u)
    388388            ggnx.remove_node(u)
    389389            for v,d in ggnx.degree_iter(X):
     
    803803    Comparison of results::
    804804
    805805        sage: from sage.graphs.hyperbolicity import hyperbolicity
    806         sage: for i in xrange(10): # long test
     806        sage: for i in xrange(10): # long time
    807807        ...       G = graphs.RandomBarabasiAlbert(100,2)
    808808        ...       d1,_,_ = hyperbolicity(G,algorithm='basic')
    809809        ...       d2,_,_ = hyperbolicity(G,algorithm='cuts')